aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-01-19 16:58:44 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-01-19 16:58:44 +0100
commit46f839c3f7476cb9016c4787729f64a2c24509d1 (patch)
tree86fc669084f4f0c8ecff60fcd3a6b11f39c5efed
parentb8d076b00bad9da87e6dcaf4f36dfd06e2d2e5e8 (diff)
downloadbusybox-w32-46f839c3f7476cb9016c4787729f64a2c24509d1.tar.gz
busybox-w32-46f839c3f7476cb9016c4787729f64a2c24509d1.tar.bz2
busybox-w32-46f839c3f7476cb9016c4787729f64a2c24509d1.zip
hush: fix a case where EXIT trap may modify its code mid-flight
function old new delta hush_exit 93 99 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 85526a9f0..7b83c736c 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1936,7 +1936,7 @@ static void hush_exit(int exitcode)
1936 if (G.exiting <= 0 && G_traps && G_traps[0] && G_traps[0][0]) { 1936 if (G.exiting <= 0 && G_traps && G_traps[0] && G_traps[0][0]) {
1937 char *argv[3]; 1937 char *argv[3];
1938 /* argv[0] is unused */ 1938 /* argv[0] is unused */
1939 argv[1] = G_traps[0]; 1939 argv[1] = xstrdup(G_traps[0]); /* copy, since EXIT trap handler may modify G_traps[0] */
1940 argv[2] = NULL; 1940 argv[2] = NULL;
1941 G.exiting = 1; /* prevent EXIT trap recursion */ 1941 G.exiting = 1; /* prevent EXIT trap recursion */
1942 /* Note: G_traps[0] is not cleared! 1942 /* Note: G_traps[0] is not cleared!