Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

Commit b25d5fc

Browse files
committed
Avoid undefined behaviors of memcpy() in gz*printf().
1 parent ae49d14 commit b25d5fc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎gzwrite.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
444444
strm->avail_in = state->size;
445445
if (gz_comp(state, Z_NO_FLUSH) == -1)
446446
return state->err;
447-
memcpy(state->in, state->in + state->size, left);
447+
memmove(state->in, state->in + state->size, left);
448448
strm->next_in = state->in;
449449
strm->avail_in = left;
450450
}
@@ -543,7 +543,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
543543
strm->avail_in = state->size;
544544
if (gz_comp(state, Z_NO_FLUSH) == -1)
545545
return state->err;
546-
memcpy(state->in, state->in + state->size, left);
546+
memmove(state->in, state->in + state->size, left);
547547
strm->next_in = state->in;
548548
strm->avail_in = left;
549549
}

0 commit comments

Comments
 (0)