Quiet some harmless PVS-Studio warnings.

This commit is contained in:
Todd C. Miller
2022-07-26 11:28:38 -06:00
parent de3d5fe934
commit f5dc739ea3
2 changed files with 7 additions and 9 deletions

View File

@@ -1022,15 +1022,15 @@ run_command(struct command_details *details)
cstat.val = 0;
if (details->command == NULL) {
sudo_warnx(U_("command not set by the security policy"));
sudo_warnx("%s", U_("command not set by the security policy"));
debug_return_int(status);
}
if (details->argv == NULL) {
sudo_warnx(U_("argv not set by the security policy"));
sudo_warnx("%s", U_("argv not set by the security policy"));
debug_return_int(status);
}
if (details->envp == NULL) {
sudo_warnx(U_("envp not set by the security policy"));
sudo_warnx("%s", U_("envp not set by the security policy"));
debug_return_int(status);
}

View File

@@ -315,13 +315,11 @@ send_policy_check_req(int sock, const char *cmnd, char * const argv[],
req.intercept_fd = sock;
req.command = (char *)cmnd;
req.argv = argv ? (char **)argv : empty;
req.n_argv = 0;
while (req.argv[req.n_argv] != NULL)
req.n_argv++;
for (req.n_argv = 0; req.argv[req.n_argv] != NULL; req.n_argv++)
continue;
req.envp = envp ? (char **)envp : empty;
req.n_envp = 0;
while (req.envp[req.n_envp] != NULL)
req.n_envp++;
for (req.n_envp = 0; req.envp[req.n_envp] != NULL; req.n_envp++)
continue;
if (getcwd(cwdbuf, sizeof(cwdbuf)) != NULL) {
req.cwd = cwdbuf;
}