Check for magic value "WUHB"

This commit is contained in:
Maschell 2021-01-09 18:50:57 +01:00
parent 63953409aa
commit e5fc7dc71c
2 changed files with 6 additions and 1 deletions

View File

@ -13,7 +13,8 @@
/// RomFS header.
typedef struct {
uint64_t headerSize; ///< Size of the header.
uint32_t headerMagic; ///< Magic value.
uint32_t headerSize; ///< Size of the header.
uint64_t dirHashTableOff; ///< Offset of the directory hash table.
uint64_t dirHashTableSize; ///< Size of the directory hash table.
uint64_t dirTableOff; ///< Offset of the directory table.

View File

@ -286,6 +286,10 @@ int32_t romfsMountCommon(const char *name, romfs_mount *mount) {
goto fail_io;
}
if (memcmp(&mount->header.headerMagic, "WUHB", sizeof(mount->header.headerMagic)) != 0) {
goto fail_io;
}
if (mount->header.headerSize != 0x50) {
goto fail_io;
}