]> git.proxmox.com Git - mirror_iproute2.git/commit
iproute2: ip maddress: Check multiaddr length
authorSascha Hauer <s.hauer@pengutronix.de>
Mon, 17 Aug 2020 11:25:19 +0000 (13:25 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Sun, 23 Aug 2020 04:12:30 +0000 (21:12 -0700)
commit7e7a1d107b7f2bb729836de25c4983f9615a2aa1
tree507b9dfb6d8f4b7179c54ee5fe95c26f04e70919
parentbf538de59d0813861fbad086d64a390002739447
iproute2: ip maddress: Check multiaddr length

ip maddress add|del takes a MAC address as argument, so insist on
getting a length of ETH_ALEN bytes. This makes sure the passed argument
is actually a MAC address and especially not an IPv4 address which
was previously accepted and silently taken as a MAC address.

While at it, do not print *argv in the error path as this has been
modified by ll_addr_a2n() and doesn't contain the full string anymore,
which can lead to misleading error messages.

Also while at it, replace the hardcoded buffer size with the actual
buffer size using sizeof().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/ipmaddr.c