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

From: Tung Quang Nguyen

Date: Wed Sep 16 2026 - 22:50:19 EST


>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 <ajithpv.linux@xxxxxxxxx>

Reviewed-by: Tung Nguyen <tung.quang.nguyen@xxxxxxxx>