because it is also used as an indicator of whether a name or an UID is
being used and we may have undefined results as 'name' may contain
uninitialized stack contents.
MFC after: 2 weeks
if (arg1 == NULL)
errx(EX_DATAERR, "username or id required");
- if (arg1[strspn(arg1, "0123456789")] == '\0')
+ if (arg1[strspn(arg1, "0123456789")] == '\0') {
id = pw_checkid(arg1, UID_MAX);
- else
+ name = NULL;
+ } else
name = arg1;
pwd = (name != NULL) ? GETPWNAM(pw_checkname(name, 0)) : GETPWUID(id);