Skip to content

DEREF_AFTER_NULL.EX.COND #632

Description

@kuznetsovvvv

static inline
prefix_range *make_prefix_range(char *str, char first, char last) {
int len;
prefix_range *pr = NULL;
if( str != NULL )
pr = build_pr(str, first, last);
else
pr = build_pr("", first, last);
len = strlen(pr->prefix);
memcpy(pr->prefix, str, len);
pr->prefix[len] = 0;
return pr_normalize(pr);
}

In the else block inside the build_pr function, "" is copied to pr->prefix. Then, in the main file, the copying is repeated. str=NULL is passed as an argument to the function in line 208, resulting in undefined behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions