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 <neerajpa...@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) {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to