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

@@ -206,7 +206,7 @@ group_plugin_load(const struct sudoers_context *ctx, const char *plugin_info)
}
}
if (ac != 0) {
argv = reallocarray(NULL, (size_t)(ac + 1), sizeof(char *));
argv = reallocarray(NULL, (size_t)ac + 1, sizeof(char *));
if (argv == NULL) {
sudo_warnx(U_("%s: %s"), __func__,
U_("unable to allocate memory"));