forked from osmocom/wireshark
Note that you *MUST* make sure "match_strval()" doesn't return null
before using its value, or must check for a null return value and handle it specially, otherwise you put Ethereal at risk of crashing with bad packet data. svn path=/trunk/; revision=11475
This commit is contained in:
parent
90bbb2c32c
commit
43b2da02ae
|
@ -1764,7 +1764,19 @@ to generate a COL_INFO line for a frame.
|
|||
|
||||
It will look up the value 'val' in the 'value_string' table pointed to
|
||||
by 'vs', and return either the corresponding string, or NULL if the
|
||||
value could not be found in the table.
|
||||
value could not be found in the table. Note that, unless 'val' is
|
||||
guaranteed to be a value in the 'value_string' table ("guaranteed" as in
|
||||
"the code has already checked that it's one of those values" or "the
|
||||
table handles all possible values of the size of 'val'", not "the
|
||||
protocol spec says it has to be" - protocol specs do not prevent invalid
|
||||
packets from being put onto a network or into a purported packet capture
|
||||
file), you must check whether 'match_strval()' returns NULL, and arrange
|
||||
that its return value not be dereferenced if it's NULL. In particular,
|
||||
don't use it in a call to generate a COL_INFO line for a frame such as
|
||||
|
||||
col_add_fstr(COL_INFO, ", %s", match_strval(val, table));
|
||||
|
||||
unless is it certain that 'val' is in 'table'.
|
||||
|
||||
'val_to_str()' can be used to generate a string for values not found in
|
||||
the table:
|
||||
|
|
Loading…
Reference in New Issue