From 4eeb29a8a7224cd42ac38fbba18a44cf58da8fe2 Mon Sep 17 00:00:00 2001 From: Stephen Fisher Date: Fri, 16 Mar 2007 00:47:26 +0000 Subject: Fix bug #1394: Runtime error crash after clicking on HTTP packet The capture file the user supplied had a HTTP chunked response in it with no actual chunks other than the zero length chunk indicating the end of the chunks. The fix is to only create a new_tvb and copy it over the tvb going into the chunked_encoding_dissector() function if the chunk size is > 0. svn path=/trunk/; revision=21034 --- epan/dissectors/packet-http.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index 9d7e4b5346..bc10bc2990 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -1379,9 +1379,13 @@ chunked_encoding_dissector(tvbuff_t **tvb_ptr, packet_info *pinfo, tvb_memcpy(tvb, (guint8 *)(raw_data + raw_len), chunk_offset, chunk_size); - new_tvb = tvb_new_real_data(raw_data, - chunked_data_size, chunked_data_size); - tvb_set_free_cb(new_tvb, g_free); + /* Don't create a new tvb if we have a single chunk with + * a size of zero (meaning it is the end of the chunks). */ + if(chunked_data_size > 0) { + new_tvb = tvb_new_real_data(raw_data, + chunked_data_size, chunked_data_size); + tvb_set_free_cb(new_tvb, g_free); + } if (subtree) { -- cgit v1.2.3