From: Peter Staubach <staubach@redhat.com>
To: Assar <assar@permabit.com>
Cc: Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
Trond Myklebust <trond.myklebust@fys.uio.no>,
Valdis.Kletnieks@vt.edu, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nfs client, kernel 2.4.31: readlink result overflow
Date: Wed, 14 Sep 2005 14:55:29 -0400 [thread overview]
Message-ID: <43287221.8020602@redhat.com> (raw)
In-Reply-To: <784q8oivp4.fsf@sober-counsel.permabit.com>
Assar wrote:
>Peter Staubach <staubach@redhat.com> writes:
>
>>>Yes, but fs/nfs/nfs2xdr.c:nfs_xdr_readlinkres on 2.4.31 writes a 0 at
>>>the end of string after having received it, which is what started this
>>>thread. Look at the end of nfs_xdr_readlinkres.
>>>
>>Yes, I know that. For C purposes, the string must be null terminated.
>
>
>Then I'm sorry but I don't understand what your point was. Do you
>believe there's a bug in nfs_xdr_readlinkres and if so, how do you
>think it should work?
>
Yes, I think that there is a bug in the boundary checking. I think that:
if (len > rcvbuf->page_len)
should be
if (len >= rcvbuf->page_len - sizeof(u32) || len > 1024)
because the code puts the length in the first 4 bytes and then the
contents of the symbolic link is stored in the rest of the page.
The ">=" accounts for the null byte will be appended to the length.
The additional check for 1024 is due to the NFS Version 2 protocol
limiting the size of the contents of a symbolic link which can be
returned to 1024 bytes.
Also, the NFS Version 3, nfs3_xdr_readlinkres, is broken in the same
way and will need to be changed in the same fashion, except that
the NFS Version 3 protocol does not place an arbitrary limit on the
size of the contents of the symbolic which can be returned. The
comparison against 1024 won't be needed here.
--
The 2.6 kernel code is also broken, but in a different, but once again,
similar fashions.
ps
next prev parent reply other threads:[~2005-09-14 19:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-12 13:26 [PATCH] nfs client, kernel 2.4.31: readlink result overflow Assar
2005-09-12 18:46 ` Valdis.Kletnieks
2005-09-12 19:37 ` Assar
2005-09-12 20:01 ` Valdis.Kletnieks
2005-09-12 20:41 ` Assar
2005-09-12 20:53 ` Valdis.Kletnieks
2005-09-13 18:39 ` Marcelo Tosatti
2005-09-13 18:52 ` Assar
2005-09-13 19:35 ` Marcelo Tosatti
2005-09-13 20:01 ` Assar
2005-09-14 18:55 ` Peter Staubach [this message]
2005-09-14 19:41 ` Assar
2005-09-14 20:11 ` Peter Staubach
2005-09-14 22:20 ` Assar
2005-09-14 22:26 ` Peter Staubach
2005-09-14 20:15 ` Peter Staubach
2005-09-14 20:26 ` Assar
2005-09-14 20:27 ` Peter Staubach
2005-09-14 20:59 ` Assar
2005-09-13 20:36 ` Peter Staubach
2005-09-13 20:55 ` Assar
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=43287221.8020602@redhat.com \
--to=staubach@redhat.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=assar@permabit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=trond.myklebust@fys.uio.no \
/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.