svn commit: r343165 - head/usr.bin/top

Justin Hibbits jhibbits at FreeBSD.org
Fri Jan 18 23:26:32 UTC 2019


Author: jhibbits
Date: Fri Jan 18 23:26:31 2019
New Revision: 343165
URL: https://svnweb.freebsd.org/changeset/base/343165

Log:
  Fix top(1) long options handling
  
  getopt_long(3) requires the long options be terminated by a NULL block.
  Without the terminator, an invalid long option results in a segmentation
  fault.
  
  Reported by:	Brandon Bergren
  MFC after:	1 week

Modified:
  head/usr.bin/top/top.c

Modified: head/usr.bin/top/top.c
==============================================================================
--- head/usr.bin/top/top.c	Fri Jan 18 23:00:52 2019	(r343164)
+++ head/usr.bin/top/top.c	Fri Jan 18 23:26:31 2019	(r343165)
@@ -110,7 +110,8 @@ static const struct option longopts[] = {
     { "uids", no_argument, NULL, 'u' },
     { "version", no_argument, NULL, 'v' },
 	{ "swap", no_argument, NULL, 'w' },
-	{ "system-idle-procs", no_argument, NULL, 'z' }
+	{ "system-idle-procs", no_argument, NULL, 'z' },
+	{ NULL, 0, NULL, 0 }
 };
 
 static void


More information about the svn-src-head mailing list