summaryrefslogtreecommitdiff
path: root/src/shared/netif-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-11-11 04:03:02 +0900
committerFrantisek Sumsal <frantisek@sumsal.cz>2021-11-10 22:11:18 +0000
commit9133c1877f8190a64b2157b32152b31009dccf6d (patch)
tree3c7eeb48ee03b9a3ce0b18cb5e2ec663543968da /src/shared/netif-util.c
parent8b212f3596d03f8e1025cd151d17f9a82433844a (diff)
downloadsystemd-9133c1877f8190a64b2157b32152b31009dccf6d.tar.gz
netif-util: fix stack-use-after-scope
Fixes a bug introduced by 0295b2fd1d97c68010c7528af13e2952886d52e0. Fixes #21292.
Diffstat (limited to 'src/shared/netif-util.c')
-rw-r--r--src/shared/netif-util.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
index 6500841e7e..85b6ad45c8 100644
--- a/src/shared/netif-util.c
+++ b/src/shared/netif-util.c
@@ -67,7 +67,7 @@ int net_get_unique_predictable_data(sd_device *device, bool use_sysname, uint64_
log_device_debug(device, "Using \"%s\" as stable identifying information", name);
- return net_get_unique_predictable_data_from_name(name, NULL, ret);
+ return net_get_unique_predictable_data_from_name(name, &HASH_KEY, ret);
}
int net_get_unique_predictable_data_from_name(
@@ -80,11 +80,9 @@ int net_get_unique_predictable_data_from_name(
int r;
assert(name);
+ assert(key);
assert(ret);
- if (!key)
- key = &HASH_KEY;
-
l = strlen(name);
sz = sizeof(sd_id128_t) + l;
v = newa(uint8_t, sz);