On Mon, Nov 17, 2025 at 06:50:03AM +0000, Dharanitharan R wrote:
The sample userspace firmware-management tool uses strncpy() to copy firmware tags. strncpy() does not guarantee null-termination and can leave buffers unterminated. For userspace code, strlcpy() is the recommended safe alternative.
Replace all strncpy() calls with strlcpy().
Don't use strlcpy(). Either use strscpy() or strscpy_pad() as appropriate. I wrote a blog about this which may be useful.
https://staticthinking.wordpress.com/2023/10/30/strcpy-strncpy-strlcpy-and-s...
regards, dan carpenter