diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-02-11 22:52:54 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-02-11 22:52:54 +0000 |
commit | 60096bfad9fa4b0ba00e5f18ad1015ba84712375 (patch) | |
tree | 2f1d2e3662a308999a9de6387364b88b0ea93e03 /epan/dfilter/dfilter.c | |
parent | b9b4a23834e80e36c180857bf3cb7065407bd9e0 (diff) | |
download | wireshark-60096bfad9fa4b0ba00e5f18ad1015ba84712375.tar.gz |
Use -1 rather than 0 as the SCAN_FAILED return value from the lexical
analyzer on errors, and check for SCAN_FAILED from the lexical analyzer
and abort the parse if we see it; 0 means "end of input", and we want to
distinguish errors from end-of-input, so that we can report errors as
such.
If we see end-of-input while parsing a double-quoted string, report the
error (missing closing quote).
Fix the URL for the "Start conditions" section of the Flex manual.
svn path=/trunk/; revision=10044
Diffstat (limited to 'epan/dfilter/dfilter.c')
-rw-r--r-- | epan/dfilter/dfilter.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/epan/dfilter/dfilter.c b/epan/dfilter/dfilter.c index 77333226cd..16f6ae9329 100644 --- a/epan/dfilter/dfilter.c +++ b/epan/dfilter/dfilter.c @@ -1,5 +1,5 @@ /* - * $Id: dfilter.c,v 1.14 2002/12/02 23:28:16 guy Exp $ + * $Id: dfilter.c,v 1.15 2004/02/11 22:52:54 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -204,6 +204,17 @@ dfilter_compile(const gchar *text, dfilter_t **dfp) df_lval = stnode_new(STTYPE_UNINITIALIZED, NULL); token = df_lex(); + /* Check for scanner failure */ + if (token == SCAN_FAILED) { + /* Free the stnode_t that we just generated, since + * we're going to give up on parsing. */ + stnode_free(df_lval); + df_lval = NULL; + + /* Give up. */ + goto FAILURE; + } + /* Check for end-of-input */ if (token == 0) { /* Tell the parser that we have reached the end of input */ |