Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jul 2020 13:37:15 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r363365 - stable/12/sbin/ping
Message-ID:  <202007201337.06KDbFsS084768@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007201337.06KDbFsS084768>