On Mon, 12 Sep 2005 09:26:28 EDT, Assar said: > In 2.4.31, the v2/3 nfs readlink accepts too long symlinks. > I have tested this by having a server return long symlinks. > 2.6.13 does not to my reading have this problem. Odd, as it has similar code - 2.6.13-mm1 nfs2xdr.c has: /* Convert length of symlink */ len = ntohl(*p++); if (len >= rcvbuf->page_len || len <= 0) { Is there some *other* code in 2.6 that prevents this from being a problem, if it's a problem on 2.4? > diff -u linux-2.4.31.orig/fs/nfs/nfs2xdr.c linux-2.4.31/fs/nfs/nfs2xdr.c > --- linux-2.4.31.orig/fs/nfs/nfs2xdr.c 2002-11-28 18:53:15.000000000 -0500 > +++ linux-2.4.31/fs/nfs/nfs2xdr.c 2005-09-07 17:36:04.000000000 -0400 > @@ -571,8 +571,8 @@ > strlen = (u32*)kmap(rcvbuf->pages[0]); > /* Convert length of symlink */ > len = ntohl(*strlen); > - if (len > rcvbuf->page_len) > - len = rcvbuf->page_len; > + if (len > rcvbuf->page_len - 1 - 4) > + len = rcvbuf->page_len - 1 - 4; Am I the only one who finds an uncommented "-1 -4" construct scary beyond belief?
Attachment:
pgpRmTFlFUVLU.pgp
Description: PGP signature
- Follow-Ups:
- References:
- Prev by Date: Re: [PATCH 2.6.13 14/14] sas-class: SCSI Host glue
- Next by Date: Re: [PATCH 2.6.13 14/14] sas-class: SCSI Host glue
- Previous by thread: [PATCH] nfs client, kernel 2.4.31: readlink result overflow
- Next by thread: Re: [PATCH] nfs client, kernel 2.4.31: readlink result overflow
- Index(es):