summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/inlines.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/inlines.c b/src/inlines.c
index f5b0621..b864e12 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -115,7 +115,8 @@ static cmark_chunk chunk_clone(cmark_mem *mem, cmark_chunk *src) {
c.len = len;
c.data = (unsigned char *)mem->calloc(len + 1, 1);
c.alloc = 1;
- memcpy(c.data, src->data, len);
+ if (len)
+ memcpy(c.data, src->data, len);
c.data[len] = '\0';
return c;