Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Nov 2022 05:37:33 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 267684] ministat segmentation fault
Message-ID:  <bug-267684-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267684

            Bug ID: 267684
           Summary: ministat segmentation fault
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: keen.sand4331@fastmail.com

[Noticed in the OpenBSD port.]

$ printf "0\n0\n0\n" | ministat - -
Segmentation fault (core dumped)

The problem is [in ministat.c] at line 646:
                nds =3D argc;
                for (i =3D 0; i < nds; i++) {
                        setfilenames[i] =3D argv[i];
                        if (!strcmp(argv[i], "-"))
---->                           setfiles[0] =3D stdin;
                        else
                                setfiles[i] =3D fopen(argv[i], "r");
                        if (setfiles[i] =3D=3D NULL)
                                err(2, "Cannot open %s", argv[i]);
                }

The simplest fix is just to change that to:
                                setfiles[i] =3D stdin;

With that in place, ministat will error out reporting that
(on second reading) the input has fewer than 3 data points.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-267684-227>