od_bloaty: fix debug code
[oweals/busybox.git] / shell / hush.c
index 85526a9f0ce406e5dd6838078555cc3853cda504..7b83c736c1ec8e77632be08d8226f9c58496ebd6 100644 (file)
@@ -1936,7 +1936,7 @@ static void hush_exit(int exitcode)
        if (G.exiting <= 0 && G_traps && G_traps[0] && G_traps[0][0]) {
                char *argv[3];
                /* argv[0] is unused */
-               argv[1] = G_traps[0];
+               argv[1] = xstrdup(G_traps[0]); /* copy, since EXIT trap handler may modify G_traps[0] */
                argv[2] = NULL;
                G.exiting = 1; /* prevent EXIT trap recursion */
                /* Note: G_traps[0] is not cleared!