* lib/userspec.c (parse_with_separator): Don’t set *username to a numeric string that is not a user name, and similarly for *groupname. Needed to fix Bug#53631. --- ChangeLog | 7 +++++++ lib/userspec.c | 2 ++ 2 files changed, 9 insertions(+)
diff --git a/ChangeLog b/ChangeLog index a202950bd9..5445802ea2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2022-02-04 Paul Eggert <egg...@cs.ucla.edu> + + userspec: help fix GNU ‘id’ incompatibility + * lib/userspec.c (parse_with_separator): + Don’t set *username to a numeric string that is not a user name, + and similarly for *groupname. Needed to fix Bug#53631. + 2022-01-30 Pádraig Brady <p...@draigbrady.com> argmatch: add variants that only match full argument diff --git a/lib/userspec.c b/lib/userspec.c index 99ac93bb53..f05ccbe635 100644 --- a/lib/userspec.c +++ b/lib/userspec.c @@ -161,6 +161,7 @@ parse_with_separator (char const *spec, char const *separator, pwd = (*u == '+' ? NULL : getpwnam (u)); if (pwd == NULL) { + username = NULL; bool use_login_group = (separator != NULL && g == NULL); if (use_login_group) { @@ -202,6 +203,7 @@ parse_with_separator (char const *spec, char const *separator, grp = (*g == '+' ? NULL : getgrnam (g)); if (grp == NULL) { + groupname = NULL; unsigned long int tmp; if (xstrtoul (g, NULL, 10, &tmp, "") == LONGINT_OK && tmp <= MAXGID && (gid_t) tmp != (gid_t) -1) -- 2.34.1