From f5dc739ea30a7ca7f6c55019e8169e4dac8e150c Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 26 Jul 2022 11:28:38 -0600 Subject: [PATCH] Quiet some harmless PVS-Studio warnings. --- src/sudo.c | 6 +++--- src/sudo_intercept_common.c | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/sudo.c b/src/sudo.c index 0121586e3..7e26b869c 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -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); } diff --git a/src/sudo_intercept_common.c b/src/sudo_intercept_common.c index ea7f0d926..9a21fefc2 100644 --- a/src/sudo_intercept_common.c +++ b/src/sudo_intercept_common.c @@ -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; }