HomeFreeBSD

MFC r340245: ping(8): improve diagnostics in case of wrong arguments.

Description

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.

Details

Provenance
eugenAuthored on
Parents
rS341713: MFC r340245: ping(8): improve diagnostics in case of wrong arguments.
Branches
Unknown
Tags
Unknown