Merge pull request #2399 from 2xsec/bugfix

coverity: #1436916
This commit is contained in:
Christian Brauner 2018-06-14 08:37:25 +02:00 committed by GitHub
commit e357d5a1fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,8 +101,10 @@ static bool lookup_user(const char *optarg, uid_t *uid)
if (sscanf(optarg, "%u", uid) < 1) { if (sscanf(optarg, "%u", uid) < 1) {
/* not a uid -- perhaps a username */ /* not a uid -- perhaps a username */
if (sscanf(optarg, "%s", name) < 1) if (sscanf(optarg, "%s", name) < 1) {
free(buf);
return false; return false;
}
ret = getpwnam_r(name, &pwent, buf, bufsize, &pwentp); ret = getpwnam_r(name, &pwent, buf, bufsize, &pwentp);
if (!pwentp) { if (!pwentp) {