diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-07-11 09:53:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-11 09:53:39 +0200 |
commit | 5c3e83145350f3ac8193a4e7dc1b3b63eb271787 (patch) | |
tree | 48214456c5b9b45dae8d973f5a918862788dc21e /src/inlines.c | |
parent | 4b83812e6780e4a58669272a7426f1491711ca8c (diff) | |
parent | ff28e0d00dbf8c4f84bbb379aa87257ae31cdd9d (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.c | 3 |
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; |