Skip to content

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

@YosefMac

Description

@YosefMac

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions