summaryrefslogtreecommitdiffstats
path: root/bin/sh/tests/builtins/trap17.0
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2016-03-28 18:58:40 +0000
committerjilles <jilles@FreeBSD.org>2016-03-28 18:58:40 +0000
commita90ad707c5487d6270fc478806ed335203056526 (patch)
tree11c5a13a8b14c23575e92ba15e8d7ebe8561772f /bin/sh/tests/builtins/trap17.0
parent2d884a83b2752861330ec6b2172e81b6c478fd17 (diff)
downloadFreeBSD-src-a90ad707c5487d6270fc478806ed335203056526.zip
FreeBSD-src-a90ad707c5487d6270fc478806ed335203056526.tar.gz
sh: Fix use-after-free if a trap replaces itself.
MFC after: 1 week
Diffstat (limited to 'bin/sh/tests/builtins/trap17.0')
-rw-r--r--bin/sh/tests/builtins/trap17.010
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/sh/tests/builtins/trap17.0 b/bin/sh/tests/builtins/trap17.0
new file mode 100644
index 0000000..89be893
--- /dev/null
+++ b/bin/sh/tests/builtins/trap17.0
@@ -0,0 +1,10 @@
+# $FreeBSD$
+# This use-after-free bug probably needs non-default settings to show up.
+
+v1=nothing v2=nothing
+trap 'trap "echo bad" USR1
+v1=trap_received
+v2=trap_invoked
+:' USR1
+kill -USR1 "$$"
+[ "$v1.$v2" = trap_received.trap_invoked ]
OpenPOWER on IntegriCloud