[PATCH] NFS: replace sprintf() with snprintf() in nfs_root_setup
From: Lalit Shankar Chowdhury
Date: Tue Sep 08 2026 - 14:55:48 EST
Replace sprintf() with snprintf() to perform bounds checking when
formatting.
Signed-off-by: Lalit Shankar Chowdhury <lalitshankarch@xxxxxxxxx>
---
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