All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Ensure user-supplied string null terminated before kstrdup()
@ 2011-02-03 22:13 Rob Landley
  2011-02-04  2:59 ` Trond Myklebust
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Landley @ 2011-02-03 22:13 UTC (permalink / raw)
  To: linux-nfs

From: Rob Landley <rlandley@parallels.com>

Make sure user string is null terminated before copying it.

Signed-off-by: Rob Landley <rlandley@parallels.com>
---

 fs/nfs/super.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index b68c860..0ad1255 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1881,9 +1881,12 @@ static int nfs_validate_mount_data(void *options,
 
 		if (!(data->flags & NFS_MOUNT_TCP))
 			args->nfs_server.protocol = XPRT_TRANSPORT_UDP;
+		/* Force null termination of data->hostname no matter what
+		   user passed in. */
+		args->namlen		= data->namlen;
+		data->namlen = 0;
 		/* N.B. caller will free nfs_server.hostname in all cases */
 		args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL);
-		args->namlen		= data->namlen;
 		args->bsize		= data->bsize;
 
 		if (data->flags & NFS_MOUNT_SECFLAVOUR)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-02-04  4:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-03 22:13 [PATCH] Ensure user-supplied string null terminated before kstrdup() Rob Landley
2011-02-04  2:59 ` Trond Myklebust
2011-02-04  3:48   ` Rob Landley
2011-02-04  4:21     ` Trond Myklebust

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.