fix a bug when modify the parameter audit_data_format, if length is more than MAX_LENGTH, the errorcode is not the expected one.
This commit is contained in:
@ -8580,6 +8580,11 @@ static void replace_config_value(char** optlines, char* name, char* value, confi
|
||||
rc = snprintf_s(newline, MAX_PARAM_LEN, MAX_PARAM_LEN - 1, "%s = %s\n", name, value);
|
||||
break;
|
||||
case PGC_STRING:
|
||||
if (strlen(name) + strlen(value) + 6 >= MAX_PARAM_LEN) {
|
||||
pfree(newline);
|
||||
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("too long for GUC parameter.")));
|
||||
}
|
||||
rc = snprintf_s(newline, MAX_PARAM_LEN, MAX_PARAM_LEN - 1, "%s = '%s'\n", name, value);
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user