Re: [PATCH] target/core: replace strncpy with strscpy

From: Martin K. Petersen
Date: Thu Jul 24 2025 - 21:52:16 EST



Pranav,

> strncpy() is deprecated and its use is discouraged. Replace strncpy()
> with safer strscpy() as the p_buf buffer should be NUL-terminated,
> since it holds human readable debug output strings.

If you must do this, please change all the similar occurrences of
strncpy() in that file instead of just one of them.

However, given the fixed size of the buffer and the length of all the
defined static strings, what is the actual problem you are fixing?

--
Martin K. Petersen