Skip to content

Commit

Permalink
mkfs: avoid out of bounds access to sb in wsect
Browse files Browse the repository at this point in the history
  • Loading branch information
rsc committed Jan 2, 2011
1 parent 2ea6c76 commit e92fd61
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mkfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ main(int argc, char *argv[])
for(i = 0; i < nblocks + usedblocks; i++)
wsect(i, zeroes);

wsect(1, &sb);
memset(buf, 0, sizeof(buf));
memmove(buf, &sb, sizeof(sb));
wsect(1, buf);

rootino = ialloc(T_DIR);
assert(rootino == ROOTINO);
Expand Down

0 comments on commit e92fd61

Please sign in to comment.