core: avoid using uninitialized buffer on bad systemd.random_seed=

unbase64mem() leaves p/sz uninitialized on failure, and the
deserialization doesn't bail out in that case, unlike other cases.

Follow-up for d247f232a8
This commit is contained in:
Luca Boccassi
2026-07-01 18:18:00 +01:00
parent 5a80137aa4
commit 7ddb3ead85
+3 -1
View 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);