Re: sockstat dumps core

From: Robert Drehmel <robert_at_spes.drehmel.com>
Date: Fri, 9 May 2003 04:50:37 +0200
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
_at__at_ -111,7 +111,7 _at__at_
 	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') {
Received on Thu May 08 2003 - 17:51:22 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:07 UTC