Browse Source

lsfd: (filter): parse "" in filter expression correctly

The original code cannot convert "" in filter expression to
a token correctly. The following command line exposes the
bug this change fixes:

  # ./lsfd  -o+ENDPOINTS  -Q '(TYPE == "")'
  zsh: IOT instruction  sudo ./lsfd -Q '(TYPE == "")'

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
pull/1640/head
Masatake YAMATO 4 months ago
parent
commit
cdbb34d0db
  1. 6
      misc-utils/lsfd-filter.c

6
misc-utils/lsfd-filter.c

@ -438,9 +438,11 @@ static void parser_read_str(struct parser *parser, struct token *token, char del
return;
}
escape = false;
} else if (c == delimiter)
} else if (c == delimiter) {
if (token->val.str == NULL)
token->val.str = xstrdup("");
return;
else if (c == '\\')
} else if (c == '\\')
escape = true;
else
xstrputc(&token->val.str, c);

Loading…
Cancel
Save