* [patch] NFS: a couple off by ones
@ 2014-12-16 23:52 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2014-12-16 23:52 UTC (permalink / raw)
To: Trond Myklebust; +Cc: linux-nfs, kernel-janitors
These tests are off by one because if len = sizeof(nfs_export_path)
then we have truncated the name.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index cd3c910..9bc9f04 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -261,11 +261,11 @@ static int __init root_nfs_data(char *cmdline)
*/
len = snprintf(nfs_export_path, sizeof(nfs_export_path),
tmp, utsname()->nodename);
- if (len > (int)sizeof(nfs_export_path))
+ if (len >= (int)sizeof(nfs_export_path))
goto out_devnametoolong;
len = snprintf(nfs_root_device, sizeof(nfs_root_device),
"%pI4:%s", &servaddr, nfs_export_path);
- if (len > (int)sizeof(nfs_root_device))
+ if (len >= (int)sizeof(nfs_root_device))
goto out_devnametoolong;
retval = 0;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-12-16 23:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-16 23:52 [patch] NFS: a couple off by ones Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).