On 2020/07/01 01:57, marfabastewart wrote:
> > Thanks, I've just fixed /etc/flow-tools/flow-tools and
> > /usr/usr/local/bin/python2.7 in -current.
> 
> Thank you very much for your quick assistance!
> 
> I did find a few new problems:
> 
> Category:    net/flow-tools
> Environment:
>     Details     : OpenBSD 6.7-current (GENERIC.MP) #306: Fri Jun 26 22:13:55 
> MDT 2020
>              
> dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>     Architecture: OpenBSD.amd64
> Description:
> 
>     1. These man pages show formatting codes instead of man pages andrunning 
> make shows errors with docbook-to-man:
>         flow-capture
>         flow-export
>         flow-header
>         flow-import
>         flow-nfilter
>         flow-report
>         flow-stat
>         flow-tools-examples
>         flow-xlate

It looks like the actual problem is in docbook-to-man but I don't have
time to investigate that so I'm going to move back to the googlecode
version which avoids this.

>     2. flow-cat ft-v05.xxx | flow-print -f -6
>     generates segmentation fault. The above extra hyphen for the 6 is a 
> deliberate error.
>     flow-print -f 6 gives IP Accounting format.

not the biggest surprise, it's quite old and mostly abandoned software
(though there aren't really a lot of alternatives so I think it's useful
to have even if imperfect).

I guess this will exist in the old version too (I don't have netflow
setup to get an export from to test at the moment)

>     2. Instead of using atoi, perhaps use strtonum and errx in the getopt 
> cases. There are
>     many calls to atoi, but I just tried to fix one in flow-print. I was 
> unable to test
>     it though. I tried just removing doc from the Makefile MAKE_FLAGS SUBDIRS 
> and apply
>     the patch below, but when I ran make install, it always seemed to install 
> the code
>     without my patch. I'm sure that part is my fault, I just don't know how 
> to correct it.
>     I tried:
>     cd /usr/ports/net/flow-tools
>     make patch
>     cd /usr/ports/pobj/flow-tools-0.68.6/flow-tools-0.68.6/src/flow-print.c
>     cp flow-print.c flow-print.c.orig
>     # edit file, then
>     cd /usr/ports/net/flow-tools
>     make update-patches
>     cd patches
>     cvs add patch-src-_flow-print_c
>     cd /usr/ports/net/flow-tools
>     cvs diff -uNp
>     make
>     make install

If you previously built a package, the above commands won't recreate it.
Try "make repackage" then "make install".

> 
>     There may be other examples of input that would generate a segmentation 
> fault.
> 
>     My patch for what it's worth:
> 
> $OpenBSD$
> 
> Index: src/flow-print.c
> --- src/flow-print.c.orig
> +++ src/flow-print.c
> @@ -28,6 +28,7 @@
> 
>  #include "ftconfig.h"
>  #include <ftlib.h>
> +#include <err.h>
> 
>  #include <sys/time.h>
>  #include <sys/types.h>
> @@ -98,6 +99,7 @@ char **argv;
>    int i, format_index, set_format, ret;
>    int print_header, options, debug;
>    char cc; /* comment character */
> +  const char *errstr;
> 
>    /* init fterr */
>    fterr_setid(argv[0]);
> @@ -124,7 +126,9 @@ char **argv;
>        break;
> 
>      case 'f': /* format */
> -      format_index = atoi(optarg);
> +      format_index = strtonum(optarg, 0, NFORMATS, &errstr);
> +      if (errstr != NULL)
> +       errx(1,"invalid report format number. %s : %s", errstr, optarg);
>        set_format = 1;
>        break;
> 
> 

Reply via email to