Bugfix: Correctly handle missing ending double quotes (+test) (Thanks mxf)

This commit is contained in:
Michael Stapelberg 2012-02-10 19:49:38 +00:00
parent 2daa8d422a
commit 82247fd0ab
2 changed files with 5 additions and 1 deletions

View 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') {

View 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');