mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-14 09:48:01 +08:00
issue #1734, avoid passing null ptr to memmove
This commit is contained in:
parent
89f2e66c80
commit
f70a407611
@ -28,7 +28,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) memmove(p, io->buf, len);
|
||||
if (len > 0 && io->buf != NULL) memmove(p, io->buf, len);
|
||||
zeromem(io->buf, io->size);
|
||||
free(io->buf);
|
||||
io->buf = (unsigned char *) p;
|
||||
|
Loading…
x
Reference in New Issue
Block a user