]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: Fix SIGSEGV in AlternativeNamesPolicy handling
authorLénaïc Huard <lenaic@lhuard.fr>
Wed, 1 Apr 2020 21:45:08 +0000 (23:45 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 2 Apr 2020 08:18:56 +0000 (10:18 +0200)
The function sd_device_get_property_value has some paths where it exits without
touching the n pointer. In those cases, n remained uninitialized until it was
eventually read inside isempty where it caused the segmentation fault.

Fixes #15078

src/udev/net/link-config.c

index 71946c9ecc75e50c5d9821d68071ab2fdb5ed043..48039511fa69bc5d778f30e7c1f1cfa1c364cad7 100644 (file)
@@ -498,7 +498,7 @@ int link_config_apply(link_config_ctx *ctx, link_config *config,
 
         if (config->alternative_names_policy)
                 for (NamePolicy *p = config->alternative_names_policy; *p != _NAMEPOLICY_INVALID; p++) {
-                        const char *n;
+                        const char *n = NULL;
 
                         switch (*p) {
                         case NAMEPOLICY_DATABASE: