diff --git a/sbin/newfs_o2fs/newfs_o2fs.c b/sbin/newfs_o2fs/newfs_o2fs.c index 0adf693..f12b08c 100644 --- a/sbin/newfs_o2fs/newfs_o2fs.c +++ b/sbin/newfs_o2fs/newfs_o2fs.c @@ -112,6 +112,7 @@ ObjID *AddFile(const char *file) ObjID *id = malloc(sizeof(ObjID)); BNode node; + memset(id, 0, sizeof(*id)); memset(&node, 0, sizeof(node)); memcpy(node.magic, BNODE_MAGIC, 8); node.versionMajor = O2FS_VERSION_MAJOR; @@ -209,6 +210,7 @@ ObjID *AddDirectory() int i; uint64_t off; + memset(id, 0, sizeof(*id)); memset(&node, 0, sizeof(node)); memcpy(node.magic, BNODE_MAGIC, 8); node.versionMajor = O2FS_VERSION_MAJOR; @@ -262,6 +264,9 @@ int main(int argc, char * const *argv) int ch; int status; + // Sanity check + assert(sizeof(BDirEntry) == 512); + struct option longopts[] = { { "manifest", required_argument, NULL, 'm' }, { "size", required_argument, NULL, 's' },