mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-10 20:48:12 +00:00
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@gmail.com> Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech> Link: https://patch.msgid.link/20260915145641.2434403-1-ajithpv.linux@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
8b85347619
commit
4bb9710c6a
3 changed files with 8 additions and 4 deletions
Loading…
Add table
Add a link
Reference in a new issue