Ethereal-users: Re: [ethereal-users] Ethereal (multiple vers) core dumps on Sol 7 with AFS traff

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Thu, 13 Jan 2000 14:53:54 -0800 (PST)
> Program terminated with signal 10, Bus Error.

	...

> Reading symbols from
> /usr/platform/SUNW,Ultra-Enterprise/lib/libc_psr.so.1...done.

Oh, big surprise, it's SPARC, not x86....

Methinks that casting "&pd[offset]" to "struct rx_header *" in
"dissect_rx()" may be ill-advised, given that there's no guarantee that
"&pd[offset]" is nicely aligned on a 4-byte boundary - in fact, it
isn't, if the stack trace is to be trusted:

> Reading symbols from /usr/lib/nss_nis.so.1...done.
> Reading symbols from /usr/lib/nss_files.so.1...done.
> #0  0x82e60 in dissect_rx (pd=0x1ecab0 "\b", offset=42, fd=0x28ea00,
> tree=0x0) at packet-rx.c:156

(0x1ecab0 is aligned on a 4-byte boundary, but 42 isn't a multiple of
4), and given that many processors (e.g., SPARC processors) don't like
unaligned references.

> Any help is appreciated.

I've attached a patch.  Apply it to "packet-rx.c", and try again.
Index: packet-rx.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/packet-rx.c,v
retrieving revision 1.6
diff -c -r1.6 packet-rx.c
*** packet-rx.c	2000/01/07 22:05:36	1.6
--- packet-rx.c	2000/01/13 22:51:57
***************
*** 115,129 ****
  		rx_tree = proto_item_add_subtree(ti, ett_rx);
  
  		proto_tree_add_item(rx_tree, hf_rx_epoch,
! 			offset, 4, ntohl(rxh->epoch));
  		proto_tree_add_item(rx_tree, hf_rx_cid,
! 			offset+4, 4, ntohl(rxh->cid));
  		proto_tree_add_item(rx_tree, hf_rx_callnumber,
! 			offset+8, 4, ntohl(rxh->callNumber));
  		proto_tree_add_item(rx_tree, hf_rx_seq,
! 			offset+12, 4, ntohl(rxh->seq));
  		proto_tree_add_item(rx_tree, hf_rx_serial,
! 			offset+16, 4, ntohl(rxh->serial));
  
  		proto_tree_add_item(rx_tree, hf_rx_type,
  			offset+20, 1, rxh->type);
--- 115,129 ----
  		rx_tree = proto_item_add_subtree(ti, ett_rx);
  
  		proto_tree_add_item(rx_tree, hf_rx_epoch,
! 			offset, 4, pntohl(&rxh->epoch));
  		proto_tree_add_item(rx_tree, hf_rx_cid,
! 			offset+4, 4, pntohl(&rxh->cid));
  		proto_tree_add_item(rx_tree, hf_rx_callnumber,
! 			offset+8, 4, pntohl(&rxh->callNumber));
  		proto_tree_add_item(rx_tree, hf_rx_seq,
! 			offset+12, 4, pntohl(&rxh->seq));
  		proto_tree_add_item(rx_tree, hf_rx_serial,
! 			offset+16, 4, pntohl(&rxh->serial));
  
  		proto_tree_add_item(rx_tree, hf_rx_type,
  			offset+20, 1, rxh->type);
***************
*** 147,155 ****
  		proto_tree_add_item(rx_tree, hf_rx_securityindex,
  			offset+23, 1, rxh->securityIndex);
  		proto_tree_add_item(rx_tree, hf_rx_spare,
! 			offset+24, 2, ntohs(rxh->spare));
  		proto_tree_add_item(rx_tree, hf_rx_serviceid,
! 			offset+26, 2, ntohs(rxh->serviceId));
  	}
  
  	if (check_col(fd, COL_INFO))
--- 147,155 ----
  		proto_tree_add_item(rx_tree, hf_rx_securityindex,
  			offset+23, 1, rxh->securityIndex);
  		proto_tree_add_item(rx_tree, hf_rx_spare,
! 			offset+24, 2, pntohs(&rxh->spare));
  		proto_tree_add_item(rx_tree, hf_rx_serviceid,
! 			offset+26, 2, pntohs(&rxh->serviceId));
  	}
  
  	if (check_col(fd, COL_INFO))
***************
*** 160,167 ****
  			"Source Port: %s  "
  			"Destination Port: %s  ",
  			val_to_str(rxh->type, rx_types, "%d"),
! 			(unsigned long)ntohl(rxh->seq),
! 			(unsigned long)ntohl(rxh->callNumber),
  			get_udp_port(pi.srcport),
  			get_udp_port(pi.destport)
  		);
--- 160,167 ----
  			"Source Port: %s  "
  			"Destination Port: %s  ",
  			val_to_str(rxh->type, rx_types, "%d"),
! 			(unsigned long)pntohl(&rxh->seq),
! 			(unsigned long)pntohl(&rxh->callNumber),
  			get_udp_port(pi.srcport),
  			get_udp_port(pi.destport)
  		);