mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 01:32:21 +02:00
net/9p: Replace strlen() strcpy() pair with strscpy()
Use the result of strscpy() for the overflow check. Signed-off-by: David Laight <david.laight.linux@gmail.com> Message-ID: <20260606202744.5113-3-david.laight.linux@gmail.com> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
This commit is contained in:
parent
574aa0b479
commit
cc8b15a2c4
|
|
@ -940,14 +940,12 @@ p9_fd_create_unix(struct p9_client *client, struct fs_context *fc)
|
|||
if (!addr || !strlen(addr))
|
||||
return -EINVAL;
|
||||
|
||||
if (strlen(addr) >= UNIX_PATH_MAX) {
|
||||
sun_server.sun_family = PF_UNIX;
|
||||
if (strscpy(sun_server.sun_path, addr) < 0) {
|
||||
pr_err("%s (%d): address too long: %s\n",
|
||||
__func__, task_pid_nr(current), addr);
|
||||
return -ENAMETOOLONG;
|
||||
}
|
||||
|
||||
sun_server.sun_family = PF_UNIX;
|
||||
strcpy(sun_server.sun_path, addr);
|
||||
err = __sock_create(current->nsproxy->net_ns, PF_UNIX,
|
||||
SOCK_STREAM, 0, &csocket, 1);
|
||||
if (err < 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user