diff --git a/src/firejail/restrict_users.c b/src/firejail/restrict_users.c index 741e908edc4..261c73ac586 100644 --- a/src/firejail/restrict_users.c +++ b/src/firejail/restrict_users.c @@ -212,7 +212,7 @@ static void sanitize_passwd(void) { // process uid int uid; int rv = sscanf(ptr, "%d:", &uid); - if (rv == 0 || uid < 0) + if (rv != 1 || uid < 0) goto errout; assert(uid_min); if (uid < uid_min || uid == 65534) { // on Debian platforms user nobody is 65534 @@ -351,7 +351,7 @@ static void sanitize_group(void) { // process uid int gid; int rv = sscanf(ptr, "%d:", &gid); - if (rv == 0 || gid < 0) + if (rv != 1 || gid < 0) goto errout; assert(gid_min); if (gid < gid_min || gid == 65534) { // on Debian platforms 65534 is group nogroup