cmark

Unnamed repository; edit this file 'description' to name the repository.

commit 5c3e83145350f3ac8193a4e7dc1b3b63eb271787
parent 4b83812e6780e4a58669272a7426f1491711ca8c
Author: John MacFarlane <jgm@berkeley.edu>
Date:   Tue, 11 Jul 2017 09:53:39 +0200

Merge pull request #212 from github/upstream/memcpy-nonnull

Avoid memcpy'ing NULL pointers
Diffstat:
Msrc/inlines.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git 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;