From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Date: Mon, 12 Jul 2010 20:04:58 +0000 Subject: Re: [patch] 9p: strlen() doesn't count the terminator Message-Id: <20100712130458.bb8ae751.akpm@linux-foundation.org> List-Id: References: <20100710095154.GU19184@bicker> In-Reply-To: <20100710095154.GU19184@bicker> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Carpenter Cc: Eric Van Hensbergen , "David S. Miller" , Abhishek Kulkarni , Venkateswararao Jujjuri , linux-kernel@vger.kernel.org, Tilman Sauerbeck , netdev@vger.kernel.org, kernel-janitors@vger.kernel.org On Sat, 10 Jul 2010 11:51:54 +0200 Dan Carpenter wrote: > 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 > > 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; This bug doesn't strike me as serious enough to warrant backporting the fix into -stable. What was your thinking there?