]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r340245: ping(8): improve diagnostics in case of wrong arguments.
authoreugen <eugen@FreeBSD.org>
Sat, 8 Dec 2018 00:33:20 +0000 (00:33 +0000)
committereugen <eugen@FreeBSD.org>
Sat, 8 Dec 2018 00:33:20 +0000 (00:33 +0000)
commitb124b4abe01ab74e54866c55b9b077d214a0870b
tree1b437e9ab2acf5361c92cfb7706a18d6a775756f
parentd306451c47aef73e1647156571a1a7eb84faeb6c
MFC r340245: ping(8): improve diagnostics in case of wrong arguments.

  For example, in case of super-user:
  $ sudo ping -s -64 127.0.0.1
  PING 127.0.0.1 (127.0.0.1): -64 data bytes
  ping: sendto: Invalid argument

  For unprivileged user:
  $ ping -s -64 127.0.0.1
  ping: packet size too large: 18446744073709551552 > 56: Operation not permitted

  Fix this by switching from strtoul() to strtol() for integer arguments
  and adding explicit checks for negative values.
sbin/ping/ping.c