ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: Re: [ethereal-dev] Segfault

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: Sun, 12 Dec 1999 23:07:49 -0600
On Sun, Dec 12, 1999 at 10:17:47PM -0600, James Coe wrote:
> 
> I've attached the backtrace from gdb and the capture file. I also used the -m 1
> option in tcpsic to slow down the traffic rate. Ethereal was run with realtime
> packet display on and name resolution off. The system is S.u.S.E. linux 6.2 with
> kernel 2.2.10. The swap file is 128Mb and there are 32Mb of physical RAM.
> 
> Jamie Coe.
> 
> 

> ethereal 0.7.9, with GTK+ 1.2.3, with libpcap 0.4, with libz 1.1.3, with UCD SNMP 4.0.1
> Linux gobel 2.2.10 #1 Fri Sep 10 08:11:17 CDT 1999 i586 unknown
> 
> (gdb) run
> Program received signal SIGSEGV, Segmentation fault.
> 0x403301de in _IO_vfprintf (s=0xbffff288, 
>     format=0x80fc240 "%s (with too-short option length = %u byte%s)", 
>     ap=0xbffff3e4) at vfprintf.c:1248
> 1248    vfprintf.c: No such file or directory.
> 
> (gdb) backtrace
> #0  0x403301de in _IO_vfprintf (s=0xbffff288, 
>     format=0x80fc240 "%s (with too-short option length = %u byte%s)", 
>     ap=0xbffff3e4) at vfprintf.c:1248
> #1  0x4033e4ac in _IO_vsnprintf (
>     string=0x821e930 "Unknown (0x57) (with too-short option length = 135250469 byteort: 32455 (32455), Seq: 402611712, Ack: 3193579776", maxlen=240, 
>     format=0x80fc240 "%s (with too-short option length = %u byte%s)", 
>     args=0xbffff3d8) at vsnprintf.c:129
> #2  0x806bcd9 in proto_tree_add_item_value (tree=0x81d2300, hfindex=916, 
>     start=51, length=2, include_format=1, visible=1, ap=0xbffff3d4)
>     at proto.c:405
> #3  0x806ba83 in proto_tree_add_text (tree=0x81d2300, start=51, length=2)
>     at proto.c:277
> #4  0x80882db in dissect_ip_tcp_options (opd=0x81d7205 "", offset=51, 
>     length=5, opttab=0x80fc0b4, nopts=8, eol=0, opt_tree=0x81d2300)
>     at packet-ip.c:651

Yup, right there. This patch will fix that error.

My current tree is in a very messed up state because of some other
work that I'm doing, but the capture file you sent appears not to
cause a segfault anymore. Can you try it with this patch?

--gilbert

Index: packet-ip.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/packet-ip.c,v
retrieving revision 1.66
diff -u -r1.66 packet-ip.c
--- packet-ip.c	1999/12/09 21:58:04	1.66
+++ packet-ip.c	1999/12/13 05:05:31
@@ -650,7 +650,7 @@
            option length. */
         proto_tree_add_text(opt_tree, offset,      2,
               "%s (with too-short option length = %u byte%s)", name,
-              plurality(len, "", "s"));
+              len, plurality(len, "", "s"));
         return;
       } else if (len - 2 > length) {
         /* Bogus - option goes past the end of the header. */