Re: [PATCH 1/3] ethdev: remove use of strncpy
Andrew Rybchenko <[email protected]>
| Newsgroups | org.dpdk.dev |
|---|---|
| Message-ID | <[email protected]> |
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: [email protected]
>
> Signed-off-by: Bruce Richardson <[email protected]>
Reviewed-by: Andrew Rybchenko <[email protected]>