Date: Sun, 20 Jan 2019 19:47:34 +0000 (UTC) From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r343222 - head/usr.bin/systat Message-ID: <201901201947.x0KJlYDa096275@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901201947.x0KJlYDa096275>