From: Mikhail Nogin Date: Mon, 25 May 2026 13:33:43 +0000 (+0300) Subject: sysusers: log new group name on write failure X-Git-Tag: v261-rc2~27 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f50c3f548b9ce41300cc8d47f0d28a91a8d78a2a;p=thirdparty%2Fsystemd.git sysusers: log new group name on write failure When adding new groups, putgrent_with_members() is called with the newly constructed group n, but the error path logs gr->gr_name. gr belongs to the earlier loop over the existing group file and may be NULL after EOF. Log n.gr_name instead. Found by Linux Verification Center (linuxtesting.org) with Svace. --- diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index cdbc053f6b3..c22dbbeda02 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -821,7 +821,7 @@ static int write_temporary_group( r = putgrent_with_members(c, &n, group); if (r < 0) return log_error_errno(r, "Failed to add new group \"%s\" to temporary group file: %m", - gr->gr_name); + n.gr_name); group_changed = true; }