condition: check for last not first ')' in firmware test expressions
I possess a machine with ')' in its BIOS version string, which will cause the current parser to mistake it as the closing ')' of the smbios-fields() expression. Let's make sure we always fo for the last, not the first ')', hence.
This commit is contained in:
@@ -659,7 +659,7 @@ static int condition_test_firmware(Condition *c, char **env) {
|
||||
_cleanup_free_ char *dtc_arg = NULL;
|
||||
char *end;
|
||||
|
||||
end = strchr(arg, ')');
|
||||
end = strrchr(arg, ')');
|
||||
if (!end || *(end + 1) != '\0') {
|
||||
log_debug("Malformed ConditionFirmware=%s", c->parameter);
|
||||
return false;
|
||||
@@ -676,7 +676,7 @@ static int condition_test_firmware(Condition *c, char **env) {
|
||||
_cleanup_free_ char *smbios_arg = NULL;
|
||||
char *end;
|
||||
|
||||
end = strchr(arg, ')');
|
||||
end = strrchr(arg, ')');
|
||||
if (!end || *(end + 1) != '\0')
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Malformed ConditionFirmware=%s: %m", c->parameter);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user