Ethereal-dev: Re: [ethereal-dev] SIGSEGV vb_decrement_usage_count (tvb=0x0, count=1) at tvbuff

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Thu, 14 Sep 2000 12:06:15 -0400
On Thu, Sep 14, 2000 at 02:58:59PM +0200, Florian Lohoff wrote:
> 
> I dont think the easy fix of
> 
> if (tvbuff == NULL) 
> 	return(0);
> 
> is correct and only considered a workaround for a bug i am currently
> unable to diagnose.

Attached is the fix. Thanks.

BTW, what is creating these Ethernet packets? The Ethernet (802.3) length
is the wrong value; it should be the length of the payload, not the
entire packet. (that is, it should not include the ethernet header length).

--gilbert
Index: tvbuff.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/tvbuff.c,v
retrieving revision 1.17
diff -u -r1.17 tvbuff.c
--- tvbuff.c	2000/09/13 20:30:06	1.17
+++ tvbuff.c	2000/09/14 16:02:11
@@ -206,7 +206,11 @@
 			break;
 
 		case TVBUFF_SUBSET:
-			tvb_decrement_usage_count(tvb->tvbuffs.subset.tvb, 1);
+			/* This will be NULL if tvb_new_subset() fails because
+			 * reported_length < -1 */
+			if (tvb->tvbuffs.subset.tvb) {
+				tvb_decrement_usage_count(tvb->tvbuffs.subset.tvb, 1);
+			}
 			break;
 
 		case TVBUFF_COMPOSITE: