netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] 9p: strlen() doesn't count the terminator
@ 2010-07-10  9:51 Dan Carpenter
  2010-07-12 20:04 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2010-07-10  9:51 UTC (permalink / raw)
  To: Eric Van Hensbergen
  Cc: David S. Miller, Abhishek Kulkarni, Venkateswararao Jujjuri,
	linux-kernel, Tilman Sauerbeck, netdev, kernel-janitors

This is an off by one bug because strlen() doesn't count the NULL
terminator.  We strcpy() addr into a fixed length array of size
UNIX_PATH_MAX later on.

The addr variable is the name of the device being mounted.

CC: stable@kernel.org
Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 98ce9bc..c85109d 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -948,7 +948,7 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args)
 
 	csocket = NULL;
 
-	if (strlen(addr) > UNIX_PATH_MAX) {
+	if (strlen(addr) >= UNIX_PATH_MAX) {
 		P9_EPRINTK(KERN_ERR, "p9_trans_unix: address too long: %s\n",
 			addr);
 		return -ENAMETOOLONG;

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

end of thread, other threads:[~2010-07-13  3:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-10  9:51 [patch] 9p: strlen() doesn't count the terminator Dan Carpenter
2010-07-12 20:04 ` Andrew Morton
2010-07-12 21:51   ` Dan Carpenter
2010-07-13  3:34   ` David Miller

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).