From: Frantisek Sumsal Date: Fri, 17 Apr 2026 12:55:29 +0000 (+0200) Subject: nspawn: avoid passing NULL to log_syntax() X-Git-Tag: v260.2~228 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=967fec09a26fcf6af3503addcc3f1b9f82e4c2c8;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. (cherry picked from commit d651df8283ce62d2f03f8abe5cd4798bd1b8bf58) --- diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c index c058ab28f71..38316f680af 100644 --- a/src/nspawn/nspawn-settings.c +++ b/src/nspawn/nspawn-settings.c @@ -717,12 +717,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; }