mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
Spot inconsistent quoting (just one single quote) (#4732)
It is possible to specify only one quote in udev rules, which is not
detected as an invalid quoting (" instead of "" for empty string).
Technically this doesn't lead to a bug, because the string ends in two
terminating nul characters at this position, but a user should still be
reminded that his configuration is invalid.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
7e3f4e7f3d
commit
cd05bb8baf
@@ -156,7 +156,7 @@ _public_ struct udev *udev_new(void) {
|
||||
|
||||
/* unquote */
|
||||
if (val[0] == '"' || val[0] == '\'') {
|
||||
if (val[len-1] != val[0]) {
|
||||
if (len == 1 || val[len-1] != val[0]) {
|
||||
log_debug("/etc/udev/udev.conf:%u: inconsistent quoting, skipping line.", line_nr);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -614,7 +614,7 @@ static int import_property_from_string(struct udev_device *dev, char *line) {
|
||||
|
||||
/* unquote */
|
||||
if (val[0] == '"' || val[0] == '\'') {
|
||||
if (val[len-1] != val[0]) {
|
||||
if (len == 1 || val[len-1] != val[0]) {
|
||||
log_debug("inconsistent quoting: '%s', skip", line);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user