From: Dan Carpenter <error27@gmail.com>
To: Eric Van Hensbergen <ericvh@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Abhishek Kulkarni <adkulkar@umail.iu.edu>,
Venkateswararao Jujjuri <jvrao@us.ibm.com>,
linux-kernel@vger.kernel.org,
Tilman Sauerbeck <tilman@code-monkey.de>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] 9p: strlen() doesn't count the terminator
Date: Sat, 10 Jul 2010 09:51:54 +0000 [thread overview]
Message-ID: <20100710095154.GU19184@bicker> (raw)
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;
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Eric Van Hensbergen <ericvh@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Abhishek Kulkarni <adkulkar@umail.iu.edu>,
Venkateswararao Jujjuri <jvrao@us.ibm.com>,
linux-kernel@vger.kernel.org,
Tilman Sauerbeck <tilman@code-monkey.de>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] 9p: strlen() doesn't count the terminator
Date: Sat, 10 Jul 2010 11:51:54 +0200 [thread overview]
Message-ID: <20100710095154.GU19184@bicker> (raw)
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;
next reply other threads:[~2010-07-10 9:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-10 9:51 Dan Carpenter [this message]
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 20:04 ` Andrew Morton
2010-07-12 21:51 ` Dan Carpenter
2010-07-12 21:51 ` Dan Carpenter
2010-07-13 3:34 ` David Miller
2010-07-13 3:34 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100710095154.GU19184@bicker \
--to=error27@gmail.com \
--cc=adkulkar@umail.iu.edu \
--cc=davem@davemloft.net \
--cc=ericvh@gmail.com \
--cc=jvrao@us.ibm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tilman@code-monkey.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.