On Thu, Aug 07, 2025 at 03:31:05PM +0200, Alexander Lobakin wrote:
> Sure, lots of drivers uses normal string copy functions etc.
> But Ethtool strings *must* be NUL-terminated, so this fixed-size +
> memcpy() only hurts.

This is the misunderstanding: they're only NUL padded, but not strictly
NUL terminated. You can see ethtool itself has to be careful with the
strings, limiting the fprintf to their sizeof():

https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/tree/ethtool.c#n1013

or using strncmp everywhere.

-- 
Kees Cook

Reply via email to