From cc6654956ac4dffe4026c395b0fb86b6fc84f90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C5=8Dshin?= Date: Sun, 3 Dec 2023 21:59:20 -0500 Subject: [PATCH] Fix auxv location calculation In the non-login-shell case, it was leaving a word of uninitialized memory at `envp[i] + 1`. This reuses the previous calculation based on `envp`. --- ape/ape-m1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ape/ape-m1.c b/ape/ape-m1.c index 838773471..4fdfbf324 100644 --- a/ape/ape-m1.c +++ b/ape/ape-m1.c @@ -993,7 +993,7 @@ int main(int argc, char **argv, char **envp) { argv = (char **)(sp2 + 1); envp = (char **)(sp2 + 1 + argc + 1); - auxv = sp2 + (auxv - sp) + 1; + auxv = (long *)(envp + i + 1); sp = sp2; /* interpret command line arguments */