submisson_package: Fix edge case with improperly sized filenames

Prevents a crash if the filename is less than 9 characters long.
This commit is contained in:
Zach Hilman 2019-04-10 12:35:42 -04:00
parent 08c0783d34
commit 0a8e540681
1 changed files with 2 additions and 1 deletions

View File

@ -248,7 +248,8 @@ void NSP::InitializeExeFSAndRomFS(const std::vector<VirtualFile>& files) {
void NSP::ReadNCAs(const std::vector<VirtualFile>& files) {
for (const auto& outer_file : files) {
if (outer_file->GetName().substr(outer_file->GetName().size() - 9) != ".cnmt.nca") {
if (outer_file->GetName().size() < 9 ||
outer_file->GetName().substr(outer_file->GetName().size() - 9) != ".cnmt.nca") {
continue;
}