aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2025-02-01 17:09:32 -0800
committerMark Adler <madler@alumni.caltech.edu>2025-02-01 17:16:39 -0800
commitab0266a36271746cea957f9edefc2ccf78aa2074 (patch)
tree4644a6986963f41cfac368b4e5435275f242a567
parentec346f1c39aa5569ec899d65ee5bba67a09ae2fc (diff)
downloadzlib-ab0266a36271746cea957f9edefc2ccf78aa2074.tar.gz
zlib-ab0266a36271746cea957f9edefc2ccf78aa2074.tar.bz2
zlib-ab0266a36271746cea957f9edefc2ccf78aa2074.zip
Avoid use of memcpy() in inflate when areas can overlap.
-rw-r--r--inflate.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/inflate.c b/inflate.c
index 4feac09..76bb8b9 100644
--- a/inflate.c
+++ b/inflate.c
@@ -884,12 +884,12 @@ int ZEXPORT inflate(z_streamp strm, int flush) {
884 if (copy > have) copy = have; 884 if (copy > have) copy = have;
885 if (copy > left) copy = left; 885 if (copy > left) copy = left;
886 if (copy == 0) goto inf_leave; 886 if (copy == 0) goto inf_leave;
887 zmemcpy(put, next, copy);
888 have -= copy; 887 have -= copy;
889 next += copy;
890 left -= copy; 888 left -= copy;
891 put += copy;
892 state->length -= copy; 889 state->length -= copy;
890 do {
891 *put++ = *next++;
892 } while (--copy);
893 break; 893 break;
894 } 894 }
895 Tracev((stderr, "inflate: stored end\n")); 895 Tracev((stderr, "inflate: stored end\n"));