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

@@ -158,7 +158,7 @@ resolve_editor(const char *ed, size_t edlen, int nfiles, char * const *files,
nargc++;
if (nfiles != 0)
nargc += nfiles + 1;
nargv = reallocarray(NULL, (size_t)(nargc + 1), sizeof(char *));
nargv = reallocarray(NULL, (size_t)nargc + 1, sizeof(char *));
if (nargv == NULL)
goto oom;
sudoers_gc_add(GC_PTR, nargv);