mkfs: avoid out of bounds access to sb in wsect

This commit is contained in:
Russ Cox 2011-01-02 17:59:57 -05:00
parent 2ea6c764c3
commit e92fd6142d

4
mkfs.c
View file

@ -90,7 +90,9 @@ main(int argc, char *argv[])
for(i = 0; i < nblocks + usedblocks; i++) for(i = 0; i < nblocks + usedblocks; i++)
wsect(i, zeroes); wsect(i, zeroes);
wsect(1, &sb); memset(buf, 0, sizeof(buf));
memmove(buf, &sb, sizeof(sb));
wsect(1, buf);
rootino = ialloc(T_DIR); rootino = ialloc(T_DIR);
assert(rootino == ROOTINO); assert(rootino == ROOTINO);