Re: [PATCH] kconfig: Replace strncpy() with strscpy()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17. 03. 25, 8:22, feng.wei8@xxxxxxxxxx wrote:
From: FengWei <feng.wei8@xxxxxxxxxx>

supplemented:
strncpy() is deprecated for NUL-terminated destination buffers. Use
strscpy() instead and remove the manual NUL-termination.

Signed-off-by: FengWei <feng.wei8@xxxxxxxxxx>
---
  scripts/kconfig/confdata.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index ac95661a1c9d..e547ce003f00 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -970,8 +970,7 @@ static int conf_touch_deps(void)
  	if (depfile_prefix_len + 1 > sizeof(depfile_path))
  		return -1;

-	strncpy(depfile_path, name, depfile_prefix_len);
-	depfile_path[depfile_prefix_len] = 0;
+	strscpy(depfile_path, name, depfile_prefix_len);

Are you aware this is userspace?

So: do you even compile-test all this?

--
js
suse labs





[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux