Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Apr 2007 04:40:15 GMT
From:      Maxim Konovalov <maxim@macomnet.ru>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: misc/112126: netstat segfaults on unusual ICMP statistics
Message-ID:  <200704260440.l3Q4eF9l096533@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/112126; it has been noted by GNATS.

From: Maxim Konovalov <maxim@macomnet.ru>
To: Christoph Weber-Fahr <cwf-ml@arcor.de>
Cc: bug-followup@freebsd.org
Subject: Re: misc/112126: netstat segfaults on unusual ICMP statistics
Date: Thu, 26 Apr 2007 08:33:27 +0400 (MSD)

 > > Can I suggest an alternative patch:
 >
 > Very funny. That's where I started - but I consider it only
 > the first half of a solution. Fixing a problem isn't all,
 > you should also strive to prevent its repetition.
 >
 > Your "fix" will break the moment someone again raises
 > ICMP_MAXTYPE without changing netstat/inet.c, too.
 
 If someone raised ICMP_MAXTYPE in netinet/ip_icmp.h the size of array
 in netstat/inet.c will be raised as well automatically because it is
 defined as
 
 static  const char *icmpnames[ICMP_MAXTYPE + 1]
 
 (Perhaps I should mention that it is required to recompile the whole
 world when such changes happen.)
 
 > If you need a utility to rely on kernel interfaces, have
 > it import them via includes.  Defining them locally, and
 > crashing when the two definitions go out of sync is just
 > bad coding style.
 
 Sure thing!  ICMP_MAXTYPE is coming from netinet/ip_icmp.h, there is
 no local definition.
 
 In your solution you have a local hardcored magic constant
 max_known_icmpname.
 
 -- 
 Maxim Konovalov



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704260440.l3Q4eF9l096533>