mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 06:25:37 +03:00
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:
parent
1a0e065e9f
commit
1dc042ae12
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user