aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9pserve.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-11-21 20:42:52 +0000
committerrsc <devnull@localhost>2005-11-21 20:42:52 +0000
commit9e2f1d9bf4c3ce413953b17fa7605b49322d1ace (patch)
tree0fa8a0b6d60628738c73e20464ae468f34b44b84 /src/cmd/9pserve.c
parent86c2ab2caf5eb4742e7cd227e6d29fc1dc74d855 (diff)
downloadplan9port-9e2f1d9bf4c3ce413953b17fa7605b49322d1ace.tar.gz
plan9port-9e2f1d9bf4c3ce413953b17fa7605b49322d1ace.tar.bz2
plan9port-9e2f1d9bf4c3ce413953b17fa7605b49322d1ace.zip
9P2000.u fixes (Lucho Ionkov)
Diffstat (limited to 'src/cmd/9pserve.c')
-rw-r--r--src/cmd/9pserve.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/cmd/9pserve.c b/src/cmd/9pserve.c
index 65bf23d0..81e4a653 100644
--- a/src/cmd/9pserve.c
+++ b/src/cmd/9pserve.c
@@ -220,6 +220,8 @@ mainproc(void *v)
f.msize = msize;
f.tag = NOTAG;
n = convS2M(&f, vbuf, sizeof vbuf);
+ if(n <= BIT16SZ)
+ sysfatal("convS2M conversion error");
if(verbose > 1) fprint(2, "%T * <- %F\n", &f);
nn = write(1, vbuf, n);
if(n != nn)
@@ -290,8 +292,10 @@ send9pmsg(Msg *m)
n = sizeS2Mu(&m->rx, m->c->dotu);
m->rpkt = emalloc(n);
nn = convS2Mu(&m->rx, m->rpkt, n, m->c->dotu);
+ if(nn <= BIT16SZ)
+ sysfatal("convS2Mu conversion error");
if(nn != n)
- sysfatal("sizeS2M + convS2M disagree");
+ sysfatal("sizeS2Mu and convS2Mu disagree");
sendq(m->c->outq, m);
}
@@ -303,8 +307,10 @@ sendomsg(Msg *m)
n = sizeS2Mu(&m->tx, m->c->dotu);
m->tpkt = emalloc(n);
nn = convS2Mu(&m->tx, m->tpkt, n, m->c->dotu);
+ if(nn <= BIT16SZ)
+ sysfatal("convS2Mu conversion error");
if(nn != n)
- sysfatal("sizeS2M + convS2M disagree");
+ sysfatal("sizeS2Mu and convS2Mu disagree");
sendq(outq, m);
}
@@ -1280,7 +1286,11 @@ repack(Fcall *f, uchar **ppkt, int dotu)
pkt = emalloc(nn);
*ppkt = pkt;
}
- convS2Mu(f, pkt, nn, dotu);
+ n = convS2Mu(f, pkt, nn, dotu);
+ if(n <= BIT16SZ)
+ sysfatal("convS2M conversion error");
+ if(n != nn)
+ sysfatal("convS2Mu and sizeS2Mu disagree");
}
void
@@ -1397,7 +1407,8 @@ cvtustat(Fcall *f, uchar **fpkt, int tounix)
n = sizeD2Mu(&dir, tounix);
buf = emalloc(n);
- convD2Mu(&dir, f->stat, n, tounix);
+ if(convD2Mu(&dir, buf, n, tounix) != n)
+ sysfatal("convD2Mu conversion error");
f->nstat = n;
f->stat = buf;