Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/tipc: replace deprecated strcpy with strscpy

The deprecated helper strcpy() performs no bounds checking on the
destination buffer. This could result in linear overflows beyond
the end of the buffer, leading to all kinds of misbehaviors.
The safe replacement is strscpy() [1].

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Link: https://patch.msgid.link/20240828123224.3697672-6-lihongbo22@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Hongbo Li and committed by
Jakub Kicinski
af1052fd 597be7bd

+1 -1
+1 -1
net/tipc/bearer.c
··· 326 326 if (!b) 327 327 return -ENOMEM; 328 328 329 - strcpy(b->name, name); 329 + strscpy(b->name, name); 330 330 b->media = m; 331 331 res = m->enable_media(net, b, attr); 332 332 if (res) {