svn commit: r363102 - head/sbin/ping

Mark Johnston markj at FreeBSD.org
Sat Jul 11 17:10:16 UTC 2020


Author: markj
Date: Sat Jul 11 17:10:16 2020
New Revision: 363102
URL: https://svnweb.freebsd.org/changeset/base/363102

Log:
  ping(8): Check for integer truncation when handling the value for -s.
  
  PR:		239976
  Submitted by:	Neeraj <neerajpal09 at gmail.com>
  MFC after:	1 week
  Event:		July 2020 Bugathon

Modified:
  head/sbin/ping/ping.c

Modified: head/sbin/ping/ping.c
==============================================================================
--- head/sbin/ping/ping.c	Sat Jul 11 17:06:48 2020	(r363101)
+++ head/sbin/ping/ping.c	Sat Jul 11 17:10:16 2020	(r363102)
@@ -478,7 +478,7 @@ main(int argc, char *const *argv)
 			break;
 		case 's':		/* size of packet to send */
 			ltmp = strtol(optarg, &ep, 0);
-			if (*ep || ep == optarg || ltmp < 0)
+			if (*ep || ep == optarg || ltmp > INT_MAX || ltmp < 0)
 				errx(EX_USAGE, "invalid packet size: `%s'",
 				    optarg);
 			if (uid != 0 && ltmp > DEFDATALEN) {


More information about the svn-src-all mailing list