From 9133c1877f8190a64b2157b32152b31009dccf6d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 11 Nov 2021 04:03:02 +0900 Subject: [PATCH] netif-util: fix stack-use-after-scope Fixes a bug introduced by 0295b2fd1d97c68010c7528af13e2952886d52e0. Fixes #21292. --- src/shared/netif-util.c | 6 ++---- 1 file 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);