Skip to content

Commit e822b72

Browse files
committed
get_execve_info: pass correct name to proc_read_link()
1 parent 1a312af commit e822b72

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/exec_ptrace.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,12 +1015,13 @@ get_execve_info(pid_t pid, struct sudo_ptrace_regs *regs, char **pathname_out,
10151015

10161016
/* For fexecve() the path may be in the form /proc/self/fd/N */
10171017
if (strncmp(argbuf, "/proc/self/fd/", 14) == 0) {
1018-
const char *errstr;
10191018
const char *fdstr = argbuf + 14;
1019+
const char *name = argbuf + 11;
1020+
const char *errstr;
10201021
(void)sudo_strtonum(fdstr, 0, INT_MAX, &errstr);
10211022
if (errstr == NULL) {
10221023
/* Rewrite argbuf with link target (if it is one). */
1023-
ssize_t len = proc_read_link(pid, fdstr, argbuf, bufsize);
1024+
ssize_t len = proc_read_link(pid, name, argbuf, bufsize);
10241025
if (len != -1)
10251026
nread = len;
10261027
}

0 commit comments

Comments
 (0)