Suppress PVS Studio false positives.

This commit is contained in:
Todd C. Miller
2021-01-06 14:27:09 -07:00
parent 108e29446d
commit 4e11bc0e26
22 changed files with 473 additions and 517 deletions

View File

@@ -434,7 +434,8 @@ get_user_groups(const char *user, struct sudo_cred *cred)
maxgroups = NGROUPS_MAX;
/* Note that macOS may return ngroups > NGROUPS_MAX. */
if ((cred->ngroups = getgroups(0, NULL)) > 0) {
cred->ngroups = getgroups(0, NULL); // -V575
if (cred->ngroups > 0) {
/* Use groups from kernel if not at limit or source is static. */
if (cred->ngroups != maxgroups || group_source == GROUP_SOURCE_STATIC) {
cred->groups = reallocarray(NULL, cred->ngroups, sizeof(GETGROUPS_T));