7 gstring(uchar *p, uchar *ep, char **s)
17 /* move it down, on top of count, to make room for '\0' */
27 gqid(uchar *p, uchar *ep, Qid *q)
41 * no syntactic checks.
42 * three causes for error:
43 * 1. message size field is incorrect
44 * 2. input buffer too short for its own data (counts too long, etc.)
45 * 3. too many names or qids
46 * gqid() and gstring() return nil if they would reach beyond buffer.
47 * main switch statement checks range and also can fall through
48 * to test at end of routine.
51 convM2S(uchar *ap, uint nap, Fcall *f)
59 if(p+BIT32SZ+BIT8SZ+BIT16SZ > ep)
64 if(size < BIT32SZ+BIT8SZ+BIT16SZ)
82 p = gstring(p, ep, &f->version);
88 f->oldtag = GBIT16(p);
97 p = gstring(p, ep, &f->uname);
100 p = gstring(p, ep, &f->aname);
114 p = gstring(p, ep, &f->uname);
117 p = gstring(p, ep, &f->aname);
123 if(p+BIT32SZ+BIT32SZ+BIT16SZ > ep)
127 f->newfid = GBIT32(p);
129 f->nwname = GBIT16(p);
131 if(f->nwname > MAXWELEM)
133 for(i=0; i<f->nwname; i++){
134 p = gstring(p, ep, &f->wname[i]);
141 if(p+BIT32SZ+BIT8SZ > ep)
154 p = gstring(p, ep, &f->name);
157 if(p+BIT32SZ+BIT8SZ > ep)
166 if(p+BIT32SZ+BIT64SZ+BIT32SZ > ep)
170 f->offset = GBIT64(p);
172 f->count = GBIT32(p);
177 if(p+BIT32SZ+BIT64SZ+BIT32SZ > ep)
181 f->offset = GBIT64(p);
183 f->count = GBIT32(p);
207 if(p+BIT32SZ+BIT16SZ > ep)
211 f->nstat = GBIT16(p);
224 f->msize = GBIT32(p);
226 p = gstring(p, ep, &f->version);
230 p = gstring(p, ep, &f->ename);
237 p = gqid(p, ep, &f->aqid);
243 p = gqid(p, ep, &f->qid);
251 f->nwqid = GBIT16(p);
253 if(f->nwqid > MAXWELEM)
255 for(i=0; i<f->nwqid; i++){
256 p = gqid(p, ep, &f->wqid[i]);
264 p = gqid(p, ep, &f->qid);
269 f->iounit = GBIT32(p);
276 f->count = GBIT32(p);
287 f->count = GBIT32(p);
298 f->nstat = GBIT16(p);