]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
netif-util: fix stack-use-after-scope
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 10 Nov 2021 19:03:02 +0000 (04:03 +0900)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 10 Nov 2021 22:11:18 +0000 (22:11 +0000)
Fixes a bug introduced by 0295b2fd1d97c68010c7528af13e2952886d52e0.

Fixes #21292.

src/shared/netif-util.c

index 6500841e7ea96fb850559f1e6804d75590064915..85b6ad45c8bcab4cd1eccad6ed19bfeae09b01a1 100644 (file)
@@ -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);