Skip to content

Commit

Permalink
vav: Don't reject individually quoted arguments
Browse files Browse the repository at this point in the history
Cli command '"help" "help"' was wrongly rejected with error
message: "Missing separator between arguments"
  • Loading branch information
walid-git committed Nov 15, 2023
1 parent ecc8832 commit f354ca9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bin/varnishtest/tests/b00008.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ varnish v1 -cliexpect 60 "param.show first_byte_timeout"
varnish v1 -cliok "param.set cli_limit 128"

varnish v1 -clierr 201 "param.show"

varnish v1 -cliok "\"help\" \"help\""
3 changes: 2 additions & 1 deletion lib/libvarnish/vav.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ VAV_ParseTxt(const char *b, const char *e, int *argc, int flag)
b++;
continue;
}
if (sep != NULL && *sep == '"' && *b == '"') {
if (sep != NULL && *sep == '"' && *b == '"' && (b - sep) < 2) {
argv[0] = err_missing_separator;
return (argv);
}
Expand Down Expand Up @@ -401,6 +401,7 @@ static const struct test_case *tests[] = {
TEST_PASS( N, "foo\"bar", "foo\"bar"),
TEST_FAIL(0 , "foo\"bar", invalid_quote),
TEST_FAIL(0 , "foo\"bar", invalid_quote),
TEST_PASS(0 , "\"foo\" \"bar\"", "foo", "bar"),
TEST_PASS( N, "\"foo\"\"bar\"", "\"foo\"\"bar\""),
TEST_FAIL(0 , "\"foo\"\"bar\"", missing_separator),
NULL
Expand Down

0 comments on commit f354ca9

Please sign in to comment.