|
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.
PolarDB-for-PostgreSQL/external/prefix/prefix.c
Lines 196 to 212 in accf02e
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.