about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/misc/wordexp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/misc/wordexp.c b/src/misc/wordexp.c
index d123cf75..db83a69f 100644
--- a/src/misc/wordexp.c
+++ b/src/misc/wordexp.c
@@ -42,7 +42,7 @@ static int do_wordexp(const char *s, wordexp_t *we, int flags)
 
 	if (flags & WRDE_NOCMD) for (i=0; s[i]; i++) switch (s[i]) {
 	case '\\':
-		if (!sq) i++;
+		if (!sq && !s[++i]) return WRDE_SYNTAX;
 		break;
 	case '\'':
 		if (!dq) sq^=1;