summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-07-23 21:09:26 +0000
committerjilles <jilles@FreeBSD.org>2013-07-23 21:09:26 +0000
commitbc9fec6137dec23cc035c0794e79ca2d9a6d7ef5 (patch)
tree34578f391a992e930f2d23ddeacef4dfb22d1dff /tools
parent5cb590fc37a5c65062a909bd466e3e341f267f99 (diff)
downloadFreeBSD-src-bc9fec6137dec23cc035c0794e79ca2d9a6d7ef5.zip
FreeBSD-src-bc9fec6137dec23cc035c0794e79ca2d9a6d7ef5.tar.gz
wordexp(): Fix syntax validation for backslashes in single-quotes.
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/lib/libc/gen/test-wordexp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/regression/lib/libc/gen/test-wordexp.c b/tools/regression/lib/libc/gen/test-wordexp.c
index d94f870..15d1b7c 100644
--- a/tools/regression/lib/libc/gen/test-wordexp.c
+++ b/tools/regression/lib/libc/gen/test-wordexp.c
@@ -195,6 +195,18 @@ main(int argc, char *argv[])
r = wordexp("test } test", &we, 0);
assert(r == WRDE_BADCHAR);
+ /* WRDE_SYNTAX */
+ r = wordexp("'", &we, 0);
+ assert(r == WRDE_SYNTAX);
+ r = wordexp("'", &we, WRDE_UNDEF);
+ assert(r == WRDE_SYNTAX);
+ r = wordexp("'\\'", &we, 0);
+ assert(r == 0);
+ assert(we.we_wordc == 1);
+ assert(strcmp(we.we_wordv[0], "\\") == 0);
+ assert(we.we_wordv[1] == NULL);
+ wordfree(&we);
+
/* With a SIGCHLD handler that reaps all zombies. */
sa.sa_flags = 0;
sigemptyset(&sa.sa_mask);
OpenPOWER on IntegriCloud