Skip to content

Commit 045dc52

Browse files
fairyfartuhaihe
authored andcommitted
Fix the regex matching bug of the GUC gp_resource_group_cgroup_parent
This is a code defect of a original GPDB on resource group enabled. There is a bug to calculate length of pg_wchar in `gpvars_check_gp_resource_group_cgroup_parent` function. For example, the value "greenplum database" was originally supposed to be judged as an illegal name, and report error: "gp_resource_group_cgroup_parent can only contains alphabet, number and non-leading . _ -". But it was wrongly judged as legal.
1 parent 4a607d4 commit 045dc52

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/backend/cdb/cdbvars.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ bool gpvars_check_gp_resource_group_cgroup_parent(char **newval, void **extra, G
580580
pg_wchar *wpattern = palloc((strlen(pattern) + 1) * sizeof(pg_wchar));
581581
int wlen = pg_mb2wchar_with_len(pattern, wpattern, strlen(pattern));
582582
pg_wchar *data = palloc((strlen(*newval) + 1) * sizeof(pg_wchar));
583-
int data_len = pg_mb2wchar_with_len(*newval, data, sizeof(*newval));
583+
int data_len = pg_mb2wchar_with_len(*newval, data, strlen(*newval));
584584
bool match = true;
585585

586586
regres = pg_regcomp(&re, wpattern, wlen, REG_ADVANCED, DEFAULT_COLLATION_OID);

0 commit comments

Comments
 (0)