summaryrefslogtreecommitdiff
path: root/mkfs.c
diff options
context:
space:
mode:
authorRuss Cox <[email protected]>2011-01-02 17:59:57 -0500
committerRuss Cox <[email protected]>2011-01-02 17:59:57 -0500
commite92fd6142de05627096a1e831140e5bd355e45be (patch)
tree201d63b061898deaed0736488ac7334246da6c8e /mkfs.c
parent2ea6c764c34d3025b5f3121a0919fda7d1eb9b01 (diff)
downloadxv6-labs-e92fd6142de05627096a1e831140e5bd355e45be.tar.gz
xv6-labs-e92fd6142de05627096a1e831140e5bd355e45be.tar.bz2
xv6-labs-e92fd6142de05627096a1e831140e5bd355e45be.zip
mkfs: avoid out of bounds access to sb in wsect
Diffstat (limited to 'mkfs.c')
-rw-r--r--mkfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mkfs.c b/mkfs.c
index 5f572cf..f227b5f 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -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);