Thread (3 messages) flat view 3 messages, 3 authors, 8d ago

RE: [PATCH net-next v6] tipc: replace deprecated strcpy with strscpy in tipc_bearer_get_name()

From: Tung Quang Nguyen <tung.quang.nguyen@est.tech>
Date: 2026-09-17 02:46:25
Also in: lkml

Subject: [PATCH net-next v6] tipc: replace deprecated strcpy with strscpy in
tipc_bearer_get_name()

The `strcpy()` function is deprecated and moving towards code-tree
elimination. Replacing it with `strscpy()` fixes potential buffer overflow vectors
by ensuring safe NULL-termination based on the destination buffer size limit
[1][2].

To make the interface safer and more robust for future callers, refactor
`tipc_bearer_get_name()` to accept a destination buffer length parameter.
Replace `strcpy()` with `strscpy()` and pass through any potential `-E2BIG`
truncation error code up to the caller. Update the existing caller in
`net/tipc/monitor.c` to pass its array size.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy
[1]
Link: https://github.com/KSPP/linux/issues/88 [2]

Signed-off-by: Ajith Parappalliyalil Venugopal <redacted>
Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help