vibraphone / cjson-bson

cJSON with support for BSON serialization
MIT License
1 stars 1 forks source link

Segmentation fault when a patch path does not begin with / #6

Open YosefMac opened 8 years ago

YosefMac commented 8 years ago

Hi, I dont know if is a part of the design that the path patch must begin with ' / ', because strrchr return NULL if not found ' / ', to avoid the segmentation fault I did the following, but I don't know if this is the best approach but it works.

In cJSON_Utils.c Line 96:

parentptr=strdup(path); childptr=strrchr(parentptr,'/');    if (childptr) *childptr++=0; else childptr = parentptr;

Line173:

 parentptr=strdup(path->valuestring);   childptr=strrchr(parentptr,'/');    if (childptr) *childptr++=0; else childptr = parentptr;
YosefMac commented 8 years ago

The / is part of rfc 6901 but still miss the validation