From eccdbbc338e83356033fa473b17d3e693e4dea65 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 24 Feb 2025 12:05:09 -0600 Subject: [PATCH] Clear inherited signal handlers/ignores in recursive exec path. --- main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 2d3fc2e8..69cc8afc 100644 --- a/main.c +++ b/main.c @@ -240,8 +240,12 @@ void toy_exec_which(struct toy_list *which, char *argv[]) // so convert to integers. (LP64 says sizeof(long)==sizeof(pointer).) // Signed typecast so stack growth direction is irrelevant: we're measuring // the distance between two pointers on the same stack, hence the labs(). - if (!CFG_TOYBOX_NORECURSE && toys.stacktop) + if (!CFG_TOYBOX_NORECURSE && toys.stacktop) { + int i; + if (labs((long)toys.stacktop-(long)&which)>24000) return; + for (i = 0; iflags&TOYFLAG_ROOTONLY) && toys.wasroot) return; -- 2.39.5