changed to null-terminate the intermediate token all the time in json.c
This commit is contained in:
parent
687d633c15
commit
727f612b38
@ -160,6 +160,7 @@ static HCL_INLINE int is_digitchar (hcl_ooci_t c)
|
|||||||
static void clear_token (hcl_json_t* json)
|
static void clear_token (hcl_json_t* json)
|
||||||
{
|
{
|
||||||
json->tok.len = 0;
|
json->tok.len = 0;
|
||||||
|
if (json->tok_capa > 0) json->tok.ptr[json->tok.len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_char_to_token (hcl_json_t* json, hcl_ooch_t ch)
|
static int add_char_to_token (hcl_json_t* json, hcl_ooch_t ch)
|
||||||
@ -178,6 +179,7 @@ static int add_char_to_token (hcl_json_t* json, hcl_ooch_t ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
json->tok.ptr[json->tok.len++] = ch;
|
json->tok.ptr[json->tok.len++] = ch;
|
||||||
|
json->tok.ptr[json->tok.len] = '\0';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user