udev: Fix SIGSEGV in AlternativeNamesPolicy handling

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
This commit is contained in:
Lénaïc Huard 2020-04-01 23:45:08 +02:00 committed by Lennart Poettering
parent e7b0ea5440
commit 61fd7d6720

View 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: