diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-03-09 00:55:28 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | 6421dd86886280e0a6b79228c0269304704be5f5 (patch) | |
tree | 9f3892ef18b1b4a1a716b58cab41aa7cefe562a9 | |
parent | 9428fceb0cacf5ff9e19116de658bcffb98efc6f (diff) |
oof
-rw-r--r-- | src/tokenizer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tokenizer.c b/src/tokenizer.c index f2f52ad..9077bb9 100644 --- a/src/tokenizer.c +++ b/src/tokenizer.c @@ -585,9 +585,9 @@ TokenizerError tokenizer_create_error(Tokenizer *self, int index, const char *fm result.index = index; result.str = NULL; - ignore_result_int(scoped_allocator_alloc(self->allocator, bytes_copied, (void**)&result.str)); - if(result.str) - am_memcpy(result.str, buffer, bytes_copied); + ignore_result_int(scoped_allocator_alloc(self->allocator, bytes_copied + 1, (void**)&result.str)); + if(result.str && bytes_copied > 0) + am_memcpy(result.str, buffer, bytes_copied + 1); return result; } |