aboutsummaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2020-07-11 17:10:16 +0000
committerMark Johnston <markj@FreeBSD.org>2020-07-11 17:10:16 +0000
commit87f9c14ad387174033ed292389a9a2350aa73dbb (patch)
tree2b19ff2ac096d0efef71094e113a646880299063 /sbin
parent5b8d2467eb3af1f14c11c0249d7f046f75808a33 (diff)
downloadsrc-87f9c14ad387174033ed292389a9a2350aa73dbb.tar.gz
src-87f9c14ad387174033ed292389a9a2350aa73dbb.zip
ping(8): Check for integer truncation when handling the value for -s.
PR: 239976 Submitted by: Neeraj <neerajpal09@gmail.com> MFC after: 1 week Event: July 2020 Bugathon
Notes
Notes: svn path=/head/; revision=363102
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ping/ping.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 011c77df816d..0b0e7a9fdd34 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -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) {