Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 May 2003 04:50:37 +0200
From:      Robert Drehmel <robert@spes.drehmel.com>
To:        Marco Wertejuk <wertejuk@mwcis.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: sockstat dumps core
Message-ID:  <20030509025037.GA2691@spes.drehmel.com>
In-Reply-To: <20030509011830.GA7306@maeko>
References:  <20030509011830.GA7306@maeko>

next in thread | previous in thread | raw e-mail | index | archive | help

Hello Marco,

On Fri, May 09, 2003 at 03:18:30AM +0200, Marco Wertejuk wrote:
> Hello,
> 
> my current snapshot is from April 30th, and I've noticed
> that sockstat -p 32768 dumps core. It does this for all
> ports larger than 32767.
> 
> Right now I don't have enough time for further investigations
> but if other experience the same problem or anyone wants the
> coredump, just tell me.

the attached patch should fix it.

ciao,
-robert


Index: sockstat.c
===================================================================
RCS file: /data/FreeBSD-current_repo/src/usr.bin/sockstat/sockstat.c,v
retrieving revision 1.6
diff -u -r1.6 sockstat.c
--- sockstat.c	13 Jan 2003 00:28:56 -0000	1.6
+++ sockstat.c	9 May 2003 02:47:36 -0000
@@ -111,7 +111,7 @@
 	int port, end;
 
 	if (ports == NULL)
-		if ((ports = calloc(1, 65536 / INT_BIT)) == NULL)
+		if ((ports = calloc(65536 / INT_BIT, sizeof(int))) == NULL)
 			err(1, "calloc()");
 	p = portspec;
 	while (*p != '\0') {



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