Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'C/7zBuf2.c')
-rw-r--r--C/7zBuf2.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/C/7zBuf2.c b/C/7zBuf2.c
index e14e65f4..430f76bf 100644
--- a/C/7zBuf2.c
+++ b/C/7zBuf2.c
@@ -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;
}