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:
parent
21a02e29de
commit
df9cd64550
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue