character constant in dfilter now must fit into one byte

The value of a string in single quotes in dfilter must fit into one
  byte. The parser correctly parsed the beginning of the string,
  however it didn't check whether there are more characters to parse.

Bug: 14084
Change-Id: Ifa2d7a31052b2c1020d84c42637b9b7afc57d8c0
Reviewed-on: https://code.wireshark.org/review/28298
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Erika Szelleova 2018-06-16 11:20:12 +02:00 committed by Guy Harris
parent 21a02e29de
commit df9cd64550
1 changed files with 7 additions and 2 deletions

View File

@ -48,7 +48,6 @@ get_sinteger(fvalue_t *fv)
return fv->value.sinteger;
}
static gboolean
parse_charconst(const char *s, unsigned long *valuep, gchar **err_msg)
{
@ -176,13 +175,19 @@ parse_charconst(const char *s, unsigned long *valuep, gchar **err_msg)
}
} else {
value = *cp;
cp++;
if (!g_ascii_isprint(value)) {
if (err_msg != NULL)
*err_msg = g_strdup_printf("Non-printable character '\\x%02lx' in character constant.", value);
return FALSE;
}
}
cp++;
if ((*cp != '\'') || (*(cp + 1) != '\0')){
if (err_msg != NULL)
*err_msg = g_strdup_printf("\"%s\" is too long to be a valid character constant.", s);
return FALSE;
}
*valuep = value;
return TRUE;
}