diff --git a/mongoose.c b/mongoose.c index e6d2351e..0f2d9e67 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1995,7 +1995,7 @@ int mg_iobuf_resize(struct mg_iobuf *io, size_t new_size) { void *p = calloc(1, new_size); if (p != NULL) { size_t len = new_size < io->len ? new_size : io->len; - if (len > 0) memcpy(p, io->buf, len); + if (len > 0) memmove(p, io->buf, len); zeromem(io->buf, io->size); free(io->buf); io->buf = (unsigned char *) p; diff --git a/src/iobuf.c b/src/iobuf.c index fda50a16..227bea7c 100644 --- a/src/iobuf.c +++ b/src/iobuf.c @@ -24,7 +24,7 @@ int mg_iobuf_resize(struct mg_iobuf *io, size_t new_size) { void *p = calloc(1, new_size); if (p != NULL) { size_t len = new_size < io->len ? new_size : io->len; - if (len > 0) memcpy(p, io->buf, len); + if (len > 0) memmove(p, io->buf, len); zeromem(io->buf, io->size); free(io->buf); io->buf = (unsigned char *) p;