Author: gonzo
Date: Sun Jan 20 19:47:33 2019
New Revision: 343222
URL: https://svnweb.freebsd.org/changeset/base/343222

Log:
  Fix crash in systat(4) when certain commands are called without arguments
  
  Add check for missing arguments to dsmatchselect and dsselect
  
  PR:           219689
  Submitted by: Marko Turk <m...@markoturk.info>
  MFC after:    1 week

Modified:
  head/usr.bin/systat/devs.c

Modified: head/usr.bin/systat/devs.c
==============================================================================
--- head/usr.bin/systat/devs.c  Sun Jan 20 18:53:32 2019        (r343221)
+++ head/usr.bin/systat/devs.c  Sun Jan 20 19:47:33 2019        (r343222)
@@ -193,6 +193,11 @@ dsmatchselect(const char *args, devstat_select_mode se
        int i;
        int retval = 0;
 
+       if (!args) {
+               warnx("dsmatchselect: no arguments");
+               return(0);
+       }
+
        /*
         * Break the (pipe delimited) input string out into separate
         * strings.
@@ -250,6 +255,11 @@ dsselect(const char *args, devstat_select_mode select_
        char *cp, *tmpstr, *tmpstr1, *buffer;
        int i;
        int retval = 0;
+
+       if (!args) {
+               warnx("dsselect: no argument");
+               return(1);
+       }
 
        /*
         * If we've gone through this code before, free previously
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to