summaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2021-11-17 10:23:02 +1300
committerRalph Boehme <slow@samba.org>2021-11-17 04:36:36 +0000
commitc3194d0d65d838b79cb5345a9d9433704b2f95ba (patch)
treec7604c5ff67ed48d7bc81590377700749747858f /testdata
parentfccb105e079df7bfe22b6887262128ab9e81064d (diff)
downloadsamba-c3194d0d65d838b79cb5345a9d9433704b2f95ba.tar.gz
test/bad_chars: ensure our tests could fail
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'testdata')
-rw-r--r--testdata/source-chars-bad.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/testdata/source-chars-bad.c b/testdata/source-chars-bad.c
new file mode 100644
index 00000000000..9b435722e13
--- /dev/null
+++ b/testdata/source-chars-bad.c
@@ -0,0 +1,23 @@
+/*
+ * "Trojan Source" CVE-2021-42574 test.
+ *
+ * Based on an example from https://lwn.net/Articles/874951/
+ */
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ int isAdmin = 0;
+
+#if 0
+ /* This is what is really there. */
+
+ /*«RLO» } «LRI»if (isAdmin)«PDI» «LRI» begin admins only */
+ puts("hello admin");
+ /* end admin only «RLO» { «LRI»*/
+#else
+ /*‮ } ⁦if (isAdmin)⁩ ⁦ begin admins only */
+ puts("hello admin");
+ /* end admin only ‮ { ⁦*/
+#endif
+}