Re: [patch] 9p: strlen() doesn't count the terminator

From: Dan Carpenter
Date: Mon Jul 12 2010 - 17:52:41 EST


On Mon, Jul 12, 2010 at 01:04:58PM -0700, Andrew Morton wrote:
> > 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?

I don't feel strongly about it. It's safe enough and it applies
cleanly. On the other hand, root should always control the name of the
device to mount so it's not a big deal.

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/