From 0a8e54068191c911806c7b825e4050afd65a794c Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Wed, 10 Apr 2019 12:35:42 -0400 Subject: submisson_package: Fix edge case with improperly sized filenames Prevents a crash if the filename is less than 9 characters long. --- src/core/file_sys/submission_package.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp index 730221fd6..ef3084681 100644 --- a/src/core/file_sys/submission_package.cpp +++ b/src/core/file_sys/submission_package.cpp @@ -248,7 +248,8 @@ void NSP::InitializeExeFSAndRomFS(const std::vector& files) { void NSP::ReadNCAs(const std::vector& 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; } -- cgit v1.2.3