summaryrefslogtreecommitdiff
blob: d45393dba4439ba3fe9faf547c030c1f289948cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
https://github.com/sudo-project/sudo/commit/7944494196d4a9b33e0ae64a7e20f86e19c336d3
https://bugs.gentoo.org/878401

From 7944494196d4a9b33e0ae64a7e20f86e19c336d3 Mon Sep 17 00:00:00 2001
From: "Todd C. Miller" <Todd.Miller@sudo.ws>
Date: Wed, 26 Oct 2022 16:35:30 -0600
Subject: [PATCH] Fix compilation error on Linux/mips.

--- a/src/exec_ptrace.c
+++ b/src/exec_ptrace.c
@@ -282,16 +282,17 @@ set_sc_arg4(struct sudo_ptrace_regs *regs, unsigned long addr)
 static bool
 ptrace_getregs(int pid, struct sudo_ptrace_regs *regs, int compat)
 {
+    struct iovec iov;
     debug_decl(ptrace_getregs, SUDO_DEBUG_EXEC);
 
+    iov.iov_base = &regs->u;
+    iov.iov_len = sizeof(regs->u);
+
 # ifdef __mips__
     /* PTRACE_GETREGSET has bugs with the MIPS o32 ABI at least. */
-    if (ptrace(PTRACE_GETREGS, pid, NULL, &regs->u) == -1)
+    if (ptrace(PTRACE_GETREGS, pid, NULL, iov.iov_base) == -1)
 	debug_return_bool(false);
 # else
-    struct iovec iov;
-    iov.iov_base = &regs->u;
-    iov.iov_len = sizeof(regs->u);
     if (ptrace(PTRACE_GETREGSET, pid, (void *)NT_PRSTATUS, &iov) == -1)
 	debug_return_bool(false);
 # endif /* __mips__ */