[PATCH 1/3] ethdev: remove use of strncpy

Andrew Rybchenko andrew.rybchenko at oktetlabs.ru
Tue Jul 21 15:26:18 CEST 2026


On 6/23/26 5:19 PM, Bruce Richardson wrote:
> The use of strncpy is not generally recommended, so replace it in code
> tokenizing the representor list. Since its use in the function is not
> involving null-terminated strings (we know that copied block will
> not involve a null value in it), we can replace strncpy with memcpy
> rather than a string function. This keeps the original intent of the
> code.
> 
> For extra safety, also add in an explicit bounds check on the length
> value before doing the memcpy.
> 
> Fixes: 9a9eb104edf6 ("ethdev: parse multiple representor devargs")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>

Reviewed-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>



More information about the dev mailing list