[Bug 219689] [PATCH] systat segfault when invoked with some invalid arguments

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed May 31 19:08:46 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219689

            Bug ID: 219689
           Summary: [PATCH] systat segfault when invoked with some invalid
                    arguments
           Product: Base System
           Version: 11.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: mt at markoturk.info
          Keywords: patch

Created attachment 183110
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=183110&action=edit
patch

Hi,

some combinations of invalid arguments can crash systat.

For example:
systat -vmstat -d
Segmentation fault (core dumped)

I've attached a patch that fixes this.

(gdb) bt
#0  strlen (str=0x0) at /usr/src/lib/libc/string/strlen.c:100
#1  0x0000000801170092 in strdup (str=0x0) at
/usr/src/lib/libc/string/strdup.c:46
#2  0x0000000000403c12 in dsselect (args=0x0, select_mode=DS_SELECT_ADDONLY,
maxshowdevs=7, s1=0x621e00) at /usr/src/usr.bin/systat/devs.c:267
#3  0x000000000040ff4e in cmdkre (cmd=<value optimized out>, args=0x0) at
_ctype.h:107
#4  0x0000000000405955 in main (argc=<value optimized out>, argv=<value
optimized out>) at /usr/src/usr.bin/systat/main.c:225
#5  0x0000000000402f1f in _start ()
#6  0x000000080063a000 in ?? ()
#7  0x0000000000000000 in ?? ()

/Marko

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


More information about the freebsd-bugs mailing list