Cast int to size_t before adding instead of casting the result.

Quiets PVS-Studio warning V1028.
This commit is contained in:
Todd C. Miller
2023-08-21 12:50:31 -06:00
parent 9f05bfd298
commit c6987aa26e
6 changed files with 9 additions and 8 deletions

View File

@@ -796,7 +796,7 @@ sudoers_policy_store_result(struct sudoers_context *ctx, bool accepted,
/* We reserve an extra spot in the list for the effective gid. */
glsize = sizeof("runas_groups=") - 1 +
((size_t)(gidlist->ngids + 1) * (MAX_UID_T_LEN + 1));
(((size_t)gidlist->ngids + 1) * (MAX_UID_T_LEN + 1));
gid_list = malloc(glsize);
if (gid_list == NULL) {
sudo_gidlist_delref(gidlist);