diff --git a/src/core/fs/archive_ncch.cpp b/src/core/fs/archive_ncch.cpp index 5935a0c5..d5a4bab5 100644 --- a/src/core/fs/archive_ncch.cpp +++ b/src/core/fs/archive_ncch.cpp @@ -142,7 +142,7 @@ std::optional NCCHArchive::readFile(FileSession* file, u64 offset, u32 size case PathType::RomFS: { const u64 romFSSize = cxi->romFS.size; const u64 romFSOffset = cxi->romFS.offset; - if ((offset >> 32) || (offset >= romFSSize) || (offset + size >= romFSSize)) { + if ((offset >> 32) || (offset >= romFSSize) || (offset + size > romFSSize)) { Helpers::panic("Tried to read from NCCH with too big of an offset"); } @@ -166,4 +166,4 @@ std::optional NCCHArchive::readFile(FileSession* file, u64 offset, u32 size } return u32(bytesRead); -} \ No newline at end of file +}