]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Correctly handle missing ending double quotes (+test) (Thanks mxf)
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 10 Feb 2012 19:49:38 +0000 (19:49 +0000)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 10 Feb 2012 19:49:38 +0000 (19:49 +0000)
src/commands_parser.c
testcases/t/187-commands-parser.t

index 1b030102ec98894c25e3a757410f7bdeea94af70..cdfafee2b9aaca0bfc5f2fc7f2fa65f5a3ea9cb1 100644 (file)
@@ -249,7 +249,7 @@ char *parse_command(const char *input) {
                 if (*walk == '"') {
                     beginning++;
                     walk++;
-                    while (*walk != '"' || *(walk-1) == '\\')
+                    while (*walk != '\0' && (*walk != '"' || *(walk-1) == '\\'))
                         walk++;
                 } else {
                     if (token->name[0] == 's') {
index ca81e2f6b66350af1f4ec2a574f61712457e791e..f019c366bed01b594afc17c34bced135155718c5 100644 (file)
@@ -165,6 +165,10 @@ is(parser_calls('workspace "foo"'),
    'cmd_workspace_name(foo)',
    'Command with simple double quotes ok');
 
+is(parser_calls('workspace "foo'),
+   'cmd_workspace_name(foo)',
+   'Command without ending double quotes ok');
+
 is(parser_calls('workspace "foo \"bar"'),
    'cmd_workspace_name(foo "bar)',
    'Command with escaped double quotes ok');