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

This commit is contained in:
cinap_lenrek 2012-02-11 13:25:23 +01:00
parent f51aa49bb0
commit 70223416cd

View file

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