]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: avoid using uninitialized buffer on bad systemd.random_seed=
authorLuca Boccassi <luca.boccassi@gmail.com>
Wed, 1 Jul 2026 15:45:34 +0000 (16:45 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 1 Jul 2026 17:18:00 +0000 (18:18 +0100)
unbase64mem() leaves p/sz uninitialized on failure, and the
deserialization doesn't bail out in that case, unlike other cases.

Follow-up for d247f232a8fd68f91769274f196566a6e9e75d15

src/core/main.c

index 30092626485b1df622f05b6a72d3344195338abe..f8a7bd0760dcbfea6cb4c81c233d318f8d5f7d58 100644 (file)
@@ -543,8 +543,10 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
                         return 0;
 
                 r = unbase64mem(value, &p, &sz);
-                if (r < 0)
+                if (r < 0) {
                         log_warning_errno(r, "Failed to parse systemd.random_seed= argument, ignoring: %s", value);
+                        return 0;
+                }
 
                 free(arg_random_seed);
                 arg_random_seed = sz > 0 ? p : mfree(p);