user-record: Handle invalid uid/gid case
I'm not that familiar with outer code to guide Coverity with an assert(), so consider invalid uid/gid as non-matching in order to avoid -EINVAL for bit shifts calculation. Fixes: CID#1590746
This commit is contained in:
@@ -350,6 +350,9 @@ int group_record_match(GroupRecord *h, const UserDBMatch *match) {
|
||||
if (!match)
|
||||
return true;
|
||||
|
||||
if (!gid_is_valid(h->gid))
|
||||
return false;
|
||||
|
||||
if (h->gid < match->gid_min || h->gid > match->gid_max)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -2775,6 +2775,9 @@ int user_record_match(UserRecord *u, const UserDBMatch *match) {
|
||||
if (!match)
|
||||
return true;
|
||||
|
||||
if (!uid_is_valid(u->uid))
|
||||
return false;
|
||||
|
||||
if (u->uid < match->uid_min || u->uid > match->uid_max)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user