cfs: fix bad memory deref in rstat (from yk's patch/cfs-rstatctlbug)

front
cinap_lenrek 2012-02-11 13:25:23 +01:00
parent f51aa49bb0
commit 70223416cd
1 changed files with 3 additions and 2 deletions

View File

@ -646,6 +646,7 @@ rwrite(Mfile *mf)
void
rstat(Mfile *mf)
{
uchar buf[STATMAX];
Dir d;
if(statson && ctltest(mf)){
@ -659,8 +660,8 @@ rstat(Mfile *mf)
d.muid = "none";
d.atime = time(nil);
d.mtime = d.atime;
c.rhdr.nstat = convD2M(&d, c.rhdr.stat,
sizeof c.rhdr - (c.rhdr.stat - (uchar*)&c.rhdr));
c.rhdr.nstat = convD2M(&d, buf, sizeof buf);
c.rhdr.stat = buf;
sendreply(0);
return;
}