sockstat dumps core

Robert Drehmel robert at spes.drehmel.com
Thu May 8 19:51:22 PDT 2003


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') {


More information about the freebsd-current mailing list