From 1391813443a724480a40e09d5daa27ebf08b925d Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 24 Aug 2021 08:34:14 -0600 Subject: [PATCH] Fix off-by-one that could result in duplicate SUDO_INTERCEPT_FD vars. --- src/exec_preload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/exec_preload.c b/src/exec_preload.c index 0288a27c6..2b2e563e7 100644 --- a/src/exec_preload.c +++ b/src/exec_preload.c @@ -101,9 +101,9 @@ sudo_preload_dso(char *envp[], const char *dso_file, int intercept_fd) continue; } if (intercept_fd != -1 && strncmp(envp[env_len], "SUDO_INTERCEPT_FD=", - sizeof("SUDO_INTERCEPT_FD=")) == 0) { + sizeof("SUDO_INTERCEPT_FD=") - 1) == 0) { if (intercept_idx == -1) { - const char *cp = envp[env_len] + sizeof("SUDO_INTERCEPT_FD="); + const char *cp = envp[env_len] + sizeof("SUDO_INTERCEPT_FD=") - 1; const char *errstr; int fd;