diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-05-31 13:35:39 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-05-31 13:35:39 +0200 |
commit | 32d19737621ac43435ef0c39424b541e867ab642 (patch) | |
tree | c39b4e1ed4190a38c5fa8364188fa6b4a28aeb76 /src | |
parent | 9dd842c540146839688bca33bfd386b925efff2c (diff) | |
parent | e10aa8549aa6a48af847c1768705ab869c6fcdb6 (diff) |
Merge pull request #49 from jeroenooms/master
Fix for UBSAN note
Diffstat (limited to 'src')
-rw-r--r-- | src/chunk.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/chunk.h b/src/chunk.h index 3d6743c..4bb4980 100644 --- a/src/chunk.h +++ b/src/chunk.h @@ -66,7 +66,9 @@ static inline const char *cmark_chunk_to_cstr(cmark_chunk *c) } str = (unsigned char *)malloc(c->len + 1); if(str != NULL) { - memcpy(str, c->data, c->len); + if(c->len > 0){ + memcpy(str, c->data, c->len); + } str[c->len] = 0; } c->data = str; |