summaryrefslogtreecommitdiff
path: root/src/inlines.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-07-11 09:53:39 +0200
committerGitHub <noreply@github.com>2017-07-11 09:53:39 +0200
commit5c3e83145350f3ac8193a4e7dc1b3b63eb271787 (patch)
tree48214456c5b9b45dae8d973f5a918862788dc21e /src/inlines.c
parent4b83812e6780e4a58669272a7426f1491711ca8c (diff)
parentff28e0d00dbf8c4f84bbb379aa87257ae31cdd9d (diff)
Merge pull request #212 from github/upstream/memcpy-nonnull
Avoid memcpy'ing NULL pointers
Diffstat (limited to 'src/inlines.c')
-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;