projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
574aa0b
)
net/9p: Replace strlen() strcpy() pair with strscpy()
author
David Laight
<david.laight.linux@gmail.com>
Sat, 6 Jun 2026 20:27:42 +0000
(21:27 +0100)
committer
Dominique Martinet
<asmadeus@codewreck.org>
Sun, 21 Jun 2026 05:22:57 +0000
(
05:22
+0000)
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>
net/9p/trans_fd.c
patch
|
blob
|
history
diff --git
a/net/9p/trans_fd.c
b/net/9p/trans_fd.c
index
dbad321
..
eb685b5
100644
(file)
--- a/
net/9p/trans_fd.c
+++ b/
net/9p/trans_fd.c
@@
-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) {