Ethereal-dev: Re: [Ethereal-dev] Crash in ethereal on AFS packets.

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

From: Guy Harris <gharris@xxxxxxxxx>
Date: Fri, 11 Oct 2002 14:59:22 -0700
On Thu, Oct 10, 2002 at 02:10:59PM -0700, Jaime Fournier wrote:
> Thanks for the prompt reply.
> Looking forward to this fix. :D

I've checked it in.  Here's a patch, if you aren't using the current CVS
version:
Index: packet-afs-macros.h
===================================================================
RCS file: /usr/local/cvsroot/ethereal/packet-afs-macros.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -c -r1.20 -r1.21
*** packet-afs-macros.h	30 Sep 2002 02:19:37 -0000	1.20
--- packet-afs-macros.h	11 Oct 2002 21:58:25 -0000	1.21
***************
*** 112,122 ****
  #define OUT_RXString(field) \
  	{	int i,len; \
  		char *tmp; \
  		i = tvb_get_ntohl(tvb, offset); \
  		offset += 4; \
  		len = ((i+4-1)/4)*4; \
  		tmp = g_malloc(i+1); \
! 		memcpy(tmp, tvb_get_ptr(tvb,offset,i), i); \
  		tmp[i] = '\0'; \
  		proto_tree_add_string(tree, field, tvb, offset-4, len+4, \
  		(void *)tmp); \
--- 112,124 ----
  #define OUT_RXString(field) \
  	{	int i,len; \
  		char *tmp; \
+ 		const char *p; \
  		i = tvb_get_ntohl(tvb, offset); \
  		offset += 4; \
+ 		p = tvb_get_ptr(tvb,offset,i); \
  		len = ((i+4-1)/4)*4; \
  		tmp = g_malloc(i+1); \
! 		memcpy(tmp, p, i); \
  		tmp[i] = '\0'; \
  		proto_tree_add_string(tree, field, tvb, offset-4, len+4, \
  		(void *)tmp); \