mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-14 17:01:07 +00:00
Tokenizer_Open: pad the string with an NULL byte
This commit is contained in:
parent
8c7fe2ae95
commit
da1b579cee
2 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
typedef struct Tokenizer
|
||||
{
|
||||
void *zdup;
|
||||
char *zdup;
|
||||
const char *input;
|
||||
unsigned numTokens;
|
||||
UINT32 *capacity;
|
||||
|
|
Loading…
Reference in a new issue