diff --git a/src/m_tokenizer.c b/src/m_tokenizer.c index 18569b24e..e1310f98f 100644 --- a/src/m_tokenizer.c +++ b/src/m_tokenizer.c @@ -15,8 +15,10 @@ tokenizer_t *Tokenizer_Open(const char *inputString, size_t len, unsigned numTokens) { tokenizer_t *tokenizer = Z_Malloc(sizeof(tokenizer_t), PU_STATIC, NULL); + const size_t lenpan = len+1; - tokenizer->zdup = malloc(len); + tokenizer->zdup = malloc(lenpan); + tokenizer->zdup[len] = 0x00; tokenizer->input = M_Memcpy(tokenizer->zdup, inputString, len); tokenizer->startPos = 0; diff --git a/src/m_tokenizer.h b/src/m_tokenizer.h index 013a310e8..7ee856b3c 100644 --- a/src/m_tokenizer.h +++ b/src/m_tokenizer.h @@ -16,7 +16,7 @@ typedef struct Tokenizer { - void *zdup; + char *zdup; const char *input; unsigned numTokens; UINT32 *capacity;