You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-04-28 21:04:55 +02:00
Throw errors on invalid StringIds in config/parse.c.
Now that the StringIds are not stored in parse.auto.c.inc it may not be obvious if an invalid StringId is generated. By moving the encoding to after the value has been validated we can error if the StringId is invalid rather than throwing an error that the value does not exist in the allow list.
This commit is contained in:
+9
-7
@@ -2594,13 +2594,8 @@ cfgParse(const Storage *const storage, const unsigned int argListSize, const cha
|
||||
strZ(cfgParseOptionValueStr(optionType, optionalRules.allowRangeMaxIdx)));
|
||||
}
|
||||
}
|
||||
// Else if StringId
|
||||
else if (optionType == cfgOptTypeStringId)
|
||||
{
|
||||
configOptionValue->value.stringId = strIdFromZN(strZ(valueAllow), strSize(valueAllow), false);
|
||||
}
|
||||
// Else if string make sure it is valid
|
||||
else
|
||||
else if (optionType != cfgOptTypeStringId)
|
||||
{
|
||||
ASSERT(optionType == cfgOptTypePath || optionType == cfgOptTypeString);
|
||||
|
||||
@@ -2665,8 +2660,15 @@ cfgParse(const Storage *const storage, const unsigned int argListSize, const cha
|
||||
switch (ruleOption->type)
|
||||
{
|
||||
case cfgOptTypeStringId:
|
||||
allowListFound = strEq(PARSE_RULE_VAL_STR_IDX(valueIdx), configOptionValue->display);
|
||||
{
|
||||
if (strEq(PARSE_RULE_VAL_STR_IDX(valueIdx), configOptionValue->display))
|
||||
{
|
||||
allowListFound = true;
|
||||
configOptionValue->value.stringId = strIdFromZ(strZ(configOptionValue->display));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
allowListFound =
|
||||
|
||||
Reference in New Issue
Block a user