> 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

    2. Improper command line input can generate a segmentation fault.

How-To-Repeat:
    1. man flow-capture, flow-export, ...
       To generate the make error: cd /usr/ports/net/flow-tools && make

    snipped output:

    Making all in docs
    gmake[1]: Entering directory 
'/usr/ports/pobj/flow-tools-0.68.6/flow-tools-0.68.6/docs'
    docbook-to-man flow-capture.sgml > flow-capture.1
    nsgmls:/usr/local/share/sgml//docbook/dsssl/modular/catalog:28:0:W: DTDDECL 
catalog entries are not supported
    Abort trap (core dumped)
    docbook-to-man flow-cat.sgml > flow-cat.1
    nsgmls:/usr/local/share/sgml//docbook/dsssl/modular/catalog:28:0:W: DTDDECL 
catalog entries are not supported

    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.

    Fix:
    1. not sure. man pages are okay in previous versions

    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

    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