mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
Fix potential core dumped for strrchr (#546)
This commit is contained in:
parent
9226e4ed8c
commit
6ea4c01e4e
@ -960,7 +960,9 @@ static int apply_patch(cJSON *object, const cJSON *patch, const cJSON_bool case_
|
|||||||
|
|
||||||
/* split pointer in parent and child */
|
/* split pointer in parent and child */
|
||||||
parent_pointer = cJSONUtils_strdup((unsigned char*)path->valuestring);
|
parent_pointer = cJSONUtils_strdup((unsigned char*)path->valuestring);
|
||||||
child_pointer = (unsigned char*)strrchr((char*)parent_pointer, '/');
|
if (parent_pointer) {
|
||||||
|
child_pointer = (unsigned char*)strrchr((char*)parent_pointer, '/');
|
||||||
|
}
|
||||||
if (child_pointer != NULL)
|
if (child_pointer != NULL)
|
||||||
{
|
{
|
||||||
child_pointer[0] = '\0';
|
child_pointer[0] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user