summaryrefslogtreecommitdiffhomepage
path: root/buffer.c
diff options
context:
space:
mode:
authorThorsten Horstmann <thorsten.horstmann@web.de>2015-02-24 22:41:26 +0800
committerThorsten Horstmann <thorsten.horstmann@web.de>2015-02-24 22:41:26 +0800
commitc5f3c550a6c9dc14655e17e1a809d18b953deb27 (patch)
tree5bf40c46b102e08013dff70eada8abe33b5e9abc /buffer.c
parent1809f741cba865b03d4db5c4ba8c41364a55d6bc (diff)
Avoid cppcheck warning
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index 01af0dd..2b35f72 100644
--- a/buffer.c
+++ b/buffer.c
@@ -99,7 +99,9 @@ buffer* buf_newcopy(buffer* buf) {
ret = buf_new(buf->len);
ret->len = buf->len;
- memcpy(ret->data, buf->data, buf->len);
+ if (buf->len > 0) {
+ memcpy(ret->data, buf->data, buf->len);
+ }
return ret;
}