svn commit: r363365 - stable/12/sbin/ping

Mark Johnston markj at FreeBSD.org
Mon Jul 20 13:37:16 UTC 2020


Author: markj
Date: Mon Jul 20 13:37:14 2020
New Revision: 363365
URL: https://svnweb.freebsd.org/changeset/base/363365

Log:
  MFC r363102:
  ping(8): Check for integer truncation when handling the value for -s.
  
  PR:	239976

Modified:
  stable/12/sbin/ping/ping.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ping/ping.c
==============================================================================
--- stable/12/sbin/ping/ping.c	Mon Jul 20 13:30:42 2020	(r363364)
+++ stable/12/sbin/ping/ping.c	Mon Jul 20 13:37:14 2020	(r363365)
@@ -475,7 +475,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-stable-12 mailing list