aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9pfuse
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-07-04 03:41:19 -0400
committerRuss Cox <rsc@swtch.com>2008-07-04 03:41:19 -0400
commit869875b48b4455937fdddb7c98fbff7699c1effb (patch)
tree67e4624aa6ee4cdd6400b13d5a6d5bbccf7e9cee /src/cmd/9pfuse
parent4712e22300315fcad068cc611de6866bb1e2a502 (diff)
downloadplan9port-869875b48b4455937fdddb7c98fbff7699c1effb.tar.gz
plan9port-869875b48b4455937fdddb7c98fbff7699c1effb.tar.bz2
plan9port-869875b48b4455937fdddb7c98fbff7699c1effb.zip
9pfuse: better handling of SETXATTR (sqweek)
Diffstat (limited to 'src/cmd/9pfuse')
-rw-r--r--src/cmd/9pfuse/fuse.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/cmd/9pfuse/fuse.c b/src/cmd/9pfuse/fuse.c
index e78bae88..5057bde1 100644
--- a/src/cmd/9pfuse/fuse.c
+++ b/src/cmd/9pfuse/fuse.c
@@ -45,7 +45,7 @@ FuseMsg*
readfusemsg(void)
{
FuseMsg *m;
- int n;
+ int n, nn;
m = allocfusemsg();
errno = 0;
@@ -173,10 +173,13 @@ readfusemsg(void)
goto bad;
break;
case FUSE_SETXATTR:
- /* struct and two strings */
- if(m->hdr->len <= sizeof(struct fuse_setxattr_in)
- || ((char*)m->tx)[m->hdr->len-1] != 0
- || memchr((uchar*)m->tx+sizeof(struct fuse_setxattr_in), 0, m->hdr->len-sizeof(struct fuse_setxattr_in)-1) == 0)
+ /* struct, one string, and one binary blob */
+ if(m->hdr->len <= sizeof(struct fuse_setxattr_in))
+ goto bad;
+ nn = ((struct fuse_setxattr_in*)m->tx)->size;
+ if(m->hdr->len < sizeof(struct fuse_setxattr_in)+nn+1)
+ goto bad;
+ if(((char*)m->tx)[m->hdr->len-nn-1] != 0)
goto bad;
break;
case FUSE_GETXATTR: