Fix zeromem() call in mg_iobuf_del()

This commit is contained in:
Sergey Lyubka 2021-08-30 11:39:19 +01:00
parent e3589577ed
commit 28a56370d4
2 changed files with 2 additions and 2 deletions

View File

@ -1782,7 +1782,7 @@ size_t mg_iobuf_del(struct mg_iobuf *io, size_t ofs, size_t len) {
if (ofs > io->len) ofs = io->len;
if (ofs + len > io->len) len = io->len - ofs;
memmove(io->buf + ofs, io->buf + ofs + len, io->len - ofs - len);
zeromem(io->buf + ofs + io->len - len, len);
zeromem(io->buf + io->len - len, len);
io->len -= len;
return len;
}

View File

@ -62,7 +62,7 @@ size_t mg_iobuf_del(struct mg_iobuf *io, size_t ofs, size_t len) {
if (ofs > io->len) ofs = io->len;
if (ofs + len > io->len) len = io->len - ofs;
memmove(io->buf + ofs, io->buf + ofs + len, io->len - ofs - len);
zeromem(io->buf + ofs + io->len - len, len);
zeromem(io->buf + io->len - len, len);
io->len -= len;
return len;
}