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@markoturk.info>
MFC after:	1 week
This commit is contained in:
Oleksandr Tymoshenko 2019-01-20 19:47:33 +00:00
parent 4945f79a4c
commit 13fe9f7f82

View File

@ -193,6 +193,11 @@ dsmatchselect(const char *args, devstat_select_mode select_mode, int maxshowdevs
int i;
int retval = 0;
if (!args) {
warnx("dsmatchselect: no arguments");
return(0);
}
/*
* Break the (pipe delimited) input string out into separate
* strings.
@ -251,6 +256,11 @@ dsselect(const char *args, devstat_select_mode select_mode, int maxshowdevs,
int i;
int retval = 0;
if (!args) {
warnx("dsselect: no argument");
return(1);
}
/*
* If we've gone through this code before, free previously
* allocated resources.