svn commit: r343222 - head/usr.bin/systat

Oleksandr Tymoshenko gonzo at FreeBSD.org
Sun Jan 20 19:47:34 UTC 2019


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 <mt at 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


More information about the svn-src-all mailing list