aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/main.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2002-03-06 19:17:06 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2002-03-06 19:17:06 +0000
commit6aad6e40b888690ad0b89d55a7c8011bdbb29760 (patch)
tree85553dd984a3962b243e04a269dd4b493f04c160 /gtk/main.c
parent6ff05ff765a8ace1e39f63e19288d58d6e3eb4bb (diff)
tvb_get_nstringz() needs to terminate a string with a NUL if the
end of the tvbuff is reached before the maximum_length passed by the caller is reached and before a terminating NUL is found. In this case, tvb_get_nstringz() returns a -1, but if the string is not artificially terminated with a NUL by tvb_get_nstringz(), the caller has no idea where the string should end because 1) the return value "-1" gives the impression that the string ends at the end of the buffer but 2) the string does not end at the end of the buffer, but somewhere in the middle, due to the packet being shorter than expected. tvb_get_nstringz() and tvb_get_nstringz0() were both modified. The FT_STRINGZ case in proto_tree_add_item() is made simpler. During regression testing, when investigating a regression that I later corrected, I discovered that strings added through proto_tree_add_item (FT_STRING, FT_STRINGZ, and FT_UINT_STRING) leaked memory due to double allocation of the string. The proto_tree_add_string*() functions do not leak memory, since they only copy the string once. The memory leak was fixed by adding another argument to the static function proto_tree_set_string() to let the string ftype code know to g_strdup() the string or not. svn path=/trunk/; revision=4891
Diffstat (limited to 'gtk/main.c')
0 files changed, 0 insertions, 0 deletions