summaryrefslogtreecommitdiff
path: root/doc/README.developer
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-07-23 01:37:35 +0000
committerGuy Harris <guy@alum.mit.edu>2004-07-23 01:37:35 +0000
commit43b2da02ae40a519abf65d141b0ea5e44a5f9a7a (patch)
tree8f159daf8c721c503d97a354ab776a0de0dc0146 /doc/README.developer
parent90bbb2c32c753af0fcc9c120e100a2a45ef0422d (diff)
downloadwireshark-43b2da02ae40a519abf65d141b0ea5e44a5f9a7a.tar.gz
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
Diffstat (limited to 'doc/README.developer')
-rw-r--r--doc/README.developer14
1 files changed, 13 insertions, 1 deletions
diff --git a/doc/README.developer b/doc/README.developer
index cf2b3407fb..db87ed7ce2 100644
--- a/doc/README.developer
+++ b/doc/README.developer
@@ -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: