diff options
Diffstat (limited to 'C/7zBuf2.c')
-rw-r--r-- | C/7zBuf2.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1,5 +1,5 @@ /* 7zBuf2.c -- Byte Buffer -2013-11-12 : Igor Pavlov : Public domain */ +2014-08-22 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -34,8 +34,11 @@ int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc) alloc->Free(alloc, p->data); p->data = data; } - memcpy(p->data + p->pos, buf, size); - p->pos += size; + if (size != 0) + { + memcpy(p->data + p->pos, buf, size); + p->pos += size; + } return 1; } |