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
This commit is contained in:
parent
5b8d2467eb
commit
87f9c14ad3
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user