]> git.proxmox.com Git - mirror_iproute2.git/commit
lib/inet_proto: Review inet_proto_{a2n,n2a}()
authorPhil Sutter <phil@nwl.cc>
Thu, 24 Aug 2017 09:51:47 +0000 (11:51 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 24 Aug 2017 21:53:14 +0000 (14:53 -0700)
commitcfda500a7d808a6e0f3eca47abd75c22cfe716e5
tree863a0581050b14287305795fe3cc1a9d50484e5d
parenteab450789829e33a64dbd08dced3438d580d5179
lib/inet_proto: Review inet_proto_{a2n,n2a}()

The original intent was to make sure strings written by those functions
are NUL-terminated at all times, though it was suggested to get rid of
the 15 char protocol name limit as well which this patch accomplishes.

In addition to that, simplify inet_proto_a2n() a bit: Use the error
checking in get_u8() to find out whether passed 'buf' contains a valid
decimal number instead of checking the first character's value manually.

Signed-off-by: Phil Sutter <phil@nwl.cc>
lib/inet_proto.c