Thread (6 messages) flat view 6 messages, 3 authors, 2025-10-07

Re: [PATCH] tracing: probes: Replace strcpy() with memcpy() in __trace_probe_log_err()

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date: 2025-08-25 07:05:45
Also in: linux-hardening, lkml

On Wed, 20 Aug 2025 23:47:18 +0200
Thorsten Blum [off-list ref] wrote:
strcpy() is deprecated; use memcpy() instead.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <redacted>
OK, looks good to me.

Thanks,
quoted hunk ↗ jump to hunk
---
 kernel/trace/trace_probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 5cbdc423afeb..d3ba5869d32c 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -214,7 +214,7 @@ void __trace_probe_log_err(int offset, int err_type)
 	p = command;
 	for (i = 0; i < trace_probe_log.argc; i++) {
 		len = strlen(trace_probe_log.argv[i]);
-		strcpy(p, trace_probe_log.argv[i]);
+		memcpy(p, trace_probe_log.argv[i], len);
 		p[len] = ' ';
 		p += len + 1;
 	}
-- 
2.50.1

-- 
Masami Hiramatsu (Google) [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help