mirror of
https://github.com/DaveGamble/cJSON.git
synced 2024-12-25 20:30:50 +08: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 */
|
||||
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)
|
||||
{
|
||||
child_pointer[0] = '\0';
|
||||
|
Loading…
x
Reference in New Issue
Block a user