* [PATCH] NFS: replace sprintf() with snprintf() in nfs_root_setup
@ 2026-09-08 18:34 Lalit Shankar Chowdhury
2026-09-09 14:04 ` Trond Myklebust
0 siblings, 1 reply; 2+ messages in thread
From: Lalit Shankar Chowdhury @ 2026-09-08 18:34 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker, open list:NFS, SUNRPC,
AND LOCKD CLIENTS, open list
Cc: Lalit Shankar Chowdhury
Replace sprintf() with snprintf() to perform bounds checking when
formatting.
Signed-off-by: Lalit Shankar Chowdhury <lalitshankarch@gmail.com>
---
fs/nfs/nfsroot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index 432612d22437..d2c26d5378a6 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -144,7 +144,7 @@ static int __init nfs_root_setup(char *line)
size_t n = strlen(line) + sizeof(NFS_ROOT) - 1;
if (n >= sizeof(nfs_root_parms))
line[sizeof(nfs_root_parms) - sizeof(NFS_ROOT) - 2] = '\0';
- sprintf(nfs_root_parms, NFS_ROOT, line);
+ snprintf(nfs_root_parms, sizeof(nfs_root_parms), NFS_ROOT, line);
}
/*
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] NFS: replace sprintf() with snprintf() in nfs_root_setup
2026-09-08 18:34 [PATCH] NFS: replace sprintf() with snprintf() in nfs_root_setup Lalit Shankar Chowdhury
@ 2026-09-09 14:04 ` Trond Myklebust
0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2026-09-09 14:04 UTC (permalink / raw)
To: Lalit Shankar Chowdhury, Anna Schumaker, open list:NFS, SUNRPC,
AND LOCKD CLIENTS, open list
On Tue, 2026-09-08 at 18:34 +0000, Lalit Shankar Chowdhury wrote:
> Replace sprintf() with snprintf() to perform bounds checking when
> formatting.
>
> Signed-off-by: Lalit Shankar Chowdhury <lalitshankarch@gmail.com>
> ---
> fs/nfs/nfsroot.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
> index 432612d22437..d2c26d5378a6 100644
> --- a/fs/nfs/nfsroot.c
> +++ b/fs/nfs/nfsroot.c
> @@ -144,7 +144,7 @@ static int __init nfs_root_setup(char *line)
> size_t n = strlen(line) + sizeof(NFS_ROOT) - 1;
> if (n >= sizeof(nfs_root_parms))
> line[sizeof(nfs_root_parms) -
> sizeof(NFS_ROOT) - 2] = '\0';
> - sprintf(nfs_root_parms, NFS_ROOT, line);
> + snprintf(nfs_root_parms, sizeof(nfs_root_parms),
> NFS_ROOT, line);
> }
>
> /*
Please see the two lines immediately above the one you're replacing.
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trondmy@kernel.org, trond.myklebust@hammerspace.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-09 14:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 18:34 [PATCH] NFS: replace sprintf() with snprintf() in nfs_root_setup Lalit Shankar Chowdhury
2026-09-09 14:04 ` Trond Myklebust
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®