From 6421dd86886280e0a6b79228c0269304704be5f5 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 9 Mar 2019 00:55:28 +0100 Subject: oof --- src/tokenizer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3