From: Frantisek Sumsal Date: Fri, 17 Apr 2026 12:55:29 +0000 (+0200) Subject: nspawn: avoid passing NULL to log_syntax() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d651df8283ce62d2f03f8abe5cd4798bd1b8bf58;p=thirdparty%2Fsystemd.git nspawn: avoid passing NULL to log_syntax() If range is NULL (i.e. when PrivateUsers= doesn't contain ':'), both later error paths will then pass NULL to log_syntax(): ~# cat foo.nspawn [Exec] PrivateUsers=9999999999999999999 ~# SYSTEMD_LOG_LEVEL=debug systemd-nspawn -D foo |& grep foo.nspawn Found settings file: /root/foo.nspawn /root/foo.nspawn:2: UID/GID shift invalid, ignoring: (null) or ~# cat foo.nspawn [Exec] PrivateUsers=4294967294 ~ # SYSTEMD_LOG_LEVEL=debug systemd-nspawn -D foo |& grep foo.nspawn Found settings file: /root/foo.nspawn /root/foo.nspawn:2: UID/GID shift and range combination invalid, ignoring: (null) Let's just use rvalue in both of these cases instead. --- diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c index 9abd5024a50..30c603394c1 100644 --- a/src/nspawn/nspawn-settings.c +++ b/src/nspawn/nspawn-settings.c @@ -720,12 +720,12 @@ int config_parse_private_users( r = parse_uid(shift, &sh); if (r < 0) { - log_syntax(unit, LOG_WARNING, filename, line, r, "UID/GID shift invalid, ignoring: %s", range); + log_syntax(unit, LOG_WARNING, filename, line, r, "UID/GID shift invalid, ignoring: %s", rvalue); return 0; } if (!userns_shift_range_valid(sh, rn)) { - log_syntax(unit, LOG_WARNING, filename, line, 0, "UID/GID shift and range combination invalid, ignoring: %s", range); + log_syntax(unit, LOG_WARNING, filename, line, 0, "UID/GID shift and range combination invalid, ignoring: %s", rvalue); return 0; }