HomeFreeBSD

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

Description

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.

MFC after: 1 month

Details

Provenance
eugenAuthored on
Parents
rS340244: MFC r340040, r340152: lualoader boot-conf and chainload
Branches
Unknown
Tags
Unknown