- Commit
- 5c3e83145350f3ac8193a4e7dc1b3b63eb271787
- Parent
- 4b83812e6780e4a58669272a7426f1491711ca8c
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Merge pull request #212 from github/upstream/memcpy-nonnull
Avoid memcpy'ing NULL pointers
My personal build of CMark ✏️
Merge pull request #212 from github/upstream/memcpy-nonnull
Avoid memcpy'ing NULL pointers
1 file changed, 2 insertions, 1 deletion
Status | File Name | N° Changes | Insertions | Deletions |
Modified | src/inlines.c | 3 | 2 | 1 |
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;