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]
Message-ID: <CAFhGd8pmq3UKBE_6ZbLyvRRhXJzaWMQ2GfosvcEEeAS-n7M4aQ@mail.gmail.com>
Date: Fri, 13 Oct 2023 12:53:53 -0700
From: Justin Stitt <justinstitt@...gle.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Heiner Kallweit <hkallweit1@...il.com>, Russell King <linux@...linux.org.uk>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org, 
	linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

On Fri, Oct 13, 2023 at 5:22 AM Andrew Lunn <andrew@...n.ch> wrote:
>
> > -     for (i = 0; i < ARRAY_SIZE(tja11xx_hw_stats); i++) {
> > -             strncpy(data + i * ETH_GSTRING_LEN,
> > -                     tja11xx_hw_stats[i].string, ETH_GSTRING_LEN);
> > -     }
> > +     for (i = 0; i < ARRAY_SIZE(tja11xx_hw_stats); i++)
> > +             ethtool_sprintf(&data, "%s", tja11xx_hw_stats[i].string);
> >  }
>
> I assume you are using "%s" because tja11xx_hw_stats[i].string cannot
> be trusted as a format string? Is this indicating we need an
> ethtool_puts() ?

Indeed, it would trigger a -Wformat-security warning.

An ethtool_puts() would be useful for this situation.

>
>         Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ