From: Yu Watanabe Date: Wed, 10 Nov 2021 19:03:02 +0000 (+0900) Subject: netif-util: fix stack-use-after-scope X-Git-Tag: v250-rc1~310 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9133c1877f8190a64b2157b32152b31009dccf6d;p=thirdparty%2Fsystemd.git netif-util: fix stack-use-after-scope Fixes a bug introduced by 0295b2fd1d97c68010c7528af13e2952886d52e0. Fixes #21292. --- diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c index 6500841e7ea..85b6ad45c8b 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);