diff options
author | Mark Adler <zlib@madler.net> | 2017-10-12 19:34:51 -0700 |
---|---|---|
committer | Mark Adler <zlib@madler.net> | 2017-10-12 19:35:59 -0700 |
commit | b25d5fcdcf4723ca3da8bc69ecc6c52010778f7c (patch) | |
tree | 96ee239a6cf0c96a4332d53ab99517d6b8ec5d5f | |
parent | ae49d1472ec176ddc53a3a4905f91d46344386e6 (diff) | |
download | zlib-b25d5fcdcf4723ca3da8bc69ecc6c52010778f7c.tar.gz zlib-b25d5fcdcf4723ca3da8bc69ecc6c52010778f7c.tar.bz2 zlib-b25d5fcdcf4723ca3da8bc69ecc6c52010778f7c.zip |
Avoid undefined behaviors of memcpy() in gz*printf().
-rw-r--r-- | gzwrite.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -444,7 +444,7 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) | |||
444 | strm->avail_in = state->size; | 444 | strm->avail_in = state->size; |
445 | if (gz_comp(state, Z_NO_FLUSH) == -1) | 445 | if (gz_comp(state, Z_NO_FLUSH) == -1) |
446 | return state->err; | 446 | return state->err; |
447 | memcpy(state->in, state->in + state->size, left); | 447 | memmove(state->in, state->in + state->size, left); |
448 | strm->next_in = state->in; | 448 | strm->next_in = state->in; |
449 | strm->avail_in = left; | 449 | strm->avail_in = left; |
450 | } | 450 | } |
@@ -543,7 +543,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, | |||
543 | strm->avail_in = state->size; | 543 | strm->avail_in = state->size; |
544 | if (gz_comp(state, Z_NO_FLUSH) == -1) | 544 | if (gz_comp(state, Z_NO_FLUSH) == -1) |
545 | return state->err; | 545 | return state->err; |
546 | memcpy(state->in, state->in + state->size, left); | 546 | memmove(state->in, state->in + state->size, left); |
547 | strm->next_in = state->in; | 547 | strm->next_in = state->in; |
548 | strm->avail_in = left; | 548 | strm->avail_in = left; |
549 | } | 549 | } |