lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 14 Aug 2020 08:27:56 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Sascha Hauer <s.hauer@...gutronix.de>
Cc:     netdev@...r.kernel.org, kernel@...gutronix.de
Subject: Re: [PATCH] iproute2: ip maddress: Check multiaddr length

On Fri, 14 Aug 2020 10:46:26 +0200
Sascha Hauer <s.hauer@...gutronix.de> wrote:

> 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.
> 
> Signed-off-by: Sascha Hauer <s.hauer@...gutronix.de>
> ---
>  ip/ipmaddr.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c
> index 3400e055..9979ed58 100644
> --- a/ip/ipmaddr.c
> +++ b/ip/ipmaddr.c
> @@ -291,7 +291,7 @@ static int multiaddr_modify(int cmd, int argc, char **argv)
>  {
>  	struct ifreq ifr = {};
>  	int family;
> -	int fd;
> +	int fd, len;
>  
>  	if (cmd == RTM_NEWADDR)
>  		cmd = SIOCADDMULTI;
> @@ -313,9 +313,12 @@ static int multiaddr_modify(int cmd, int argc, char **argv)
>  				usage();
>  			if (ifr.ifr_hwaddr.sa_data[0])
>  				duparg("address", *argv);
> -			if (ll_addr_a2n(ifr.ifr_hwaddr.sa_data,
> -					14, *argv) < 0) {
> -				fprintf(stderr, "Error: \"%s\" is not a legal ll address.\n", *argv);
> +			len = ll_addr_a2n(ifr.ifr_hwaddr.sa_data, 14, *argv);

While you are at it, get rid of the hard code 14 here and use sizeof(ifr.ifr_hwaddr.sa_data)?

Powered by blists - more mailing lists