mirror of https://github.com/kgabis/parson.git
Fix memleak when parsing keys with embedded null bytes (#157)
* Fix memleak when parsing key with embedded null byte This commit fixes and adds a test for a memory leak that occurs when parsing strings with keys that have a null byte embedded in them. This memory leak can be triggered with the following line, where this call returns a `NULL`: ```c json_parse_string("{\"\\u0000\"") ``` This memory leak happens in the `parse_object_value` function in here: ``` new_key = get_quoted_string(string, &key_len); <---- ALLOCATION /* We do not support key names with embedded \0 chars */ if (new_key == NULL || key_len != strlen(new_key)) { json_value_free(output_value); return NULL; <---- `new_key` NOT FREED } SKIP_WHITESPACES(string); if (**string != ':') { parson_free(new_key); json_value_free(output_value); return NULL; } ``` * Increments version to 1.1.2 Co-authored-by: Krzysztof Gabis <kgabis@gmail.com>pull/45/merge
parent
60b2c69f17
commit
ab7f5e5401
Loading…
Reference in new issue