From: Tobias Stoeckmann Date: Thu, 1 Dec 2016 23:46:36 +0000 (+0100) Subject: Spot inconsistent quoting (just one single quote) (#4732) X-Git-Tag: v233~364 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cd05bb8bafa808f0a40feaaa0e8cc564c0f203a7;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c index 63fb05547de..57ce749e072 100644 --- a/src/libudev/libudev.c +++ b/src/libudev/libudev.c @@ -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; } diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index f6c416bf704..d88687e9c2b 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -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; }