[flow-tools] flow-capture segfaults

Mark Fullmer maf@eng.oar.net
Sat, 20 Oct 2001 13:22:25 -0400


The following patches to ftio.c and support.c should fix this.

Index: support.c
===================================================================
RCS file: /usr/home/djnz-cvsroot/flow-tools/lib/support.c,v
retrieving revision 1.20
diff -c -r1.20 support.c
*** support.c   2001/07/15 19:19:30     1.20
--- support.c   2001/10/20 16:13:49
***************
*** 163,169 ****
  
    locip = remip = dstport = ttl = (char*)0L;
  
!   if (!(s = malloc(strlen(input+1)))) {
      fterr_warn("malloc");
      return ftpi;
    }
--- 163,169 ----
  
    locip = remip = dstport = ttl = (char*)0L;
  
!   if (!(s = malloc(strlen(input)+1))) {
      fterr_warn("malloc");
      return ftpi;
    }


Index: ftio.c
===================================================================
RCS file: /usr/home/djnz-cvsroot/flow-tools/lib/ftio.c,v
retrieving revision 1.29
diff -c -r1.29 ftio.c
*** ftio.c      2001/07/06 14:26:59     1.29
--- ftio.c      2001/10/20 17:21:26
***************
*** 432,438 ****
    if (ftio->fth.comments)
      free(ftio->fth.comments);

!   if (!(ftio->fth.comments = (char*)malloc(strlen(comment)))) {
      fterr_warn("malloc()");
      return -1;
    }
--- 432,438 ----
    if (ftio->fth.comments)
      free(ftio->fth.comments);

!   if (!(ftio->fth.comments = (char*)malloc(strlen(comment)+1))) {
      fterr_warn("malloc()");
      return -1;
    }
***************
*** 455,461 ****
    if (ftio->fth.cap_hostname)
      free(ftio->fth.cap_hostname);

!   if (!(ftio->fth.cap_hostname = (char*)malloc(strlen(hostname)))) {
      fterr_warn("malloc()");
    }
    strcpy(ftio->fth.cap_hostname, hostname);
--- 455,461 ----
    if (ftio->fth.cap_hostname)
      free(ftio->fth.cap_hostname);

!   if (!(ftio->fth.cap_hostname = (char*)malloc(strlen(hostname)+1))) {
      fterr_warn("malloc()");
    }
    strcpy(ftio->fth.cap_hostname, hostname);


On Fri, Oct 05, 2001 at 04:11:13PM +0200, Ferry Korving wrote:
> Hello,
> 
> Since we installed new 6000's I'm trying to replace cflowd
> with flow-tools. I'm experiencing core dumps with flow-capture
> however. After
> 
> #./flow-capture -D -N0 -V5 -w/usr/local/share/flows-new xxx.xxx.xxx.xxx/2055
> 
> I get a segmentation fault and a core dump, most of the time
> immediately after the command above and sometimes after the
> first ft-file has been written. I tried various commandline
> options, to no avail.
> 
> I'm using RH7.0 and flow-tools 0.55, and I already tried
> the patch which was posted recently to this list.
> 
> Any help?
> 
> best regards,
> 
> Ferry Korving
> 
> 
> 
> _______________________________________________
> flow-tools@splintered.net
> http://www.splintered.net/sw/flow-tools