From dade709f6347ca3b27a0577efc25adae8e89bcf8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 3 Oct 2018 02:06:26 -0400 Subject: submission_package: Correct location of null check within SetTicketKeys() If a ticket file was ever a null pointer, we'd cause a null pointer dereference, as we were calling GetExtension() on the pointer instance. --- src/core/file_sys/submission_package.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp index c3848e826..829aca06f 100644 --- a/src/core/file_sys/submission_package.cpp +++ b/src/core/file_sys/submission_package.cpp @@ -23,13 +23,16 @@ void SetTicketKeys(const std::vector& files) { Core::Crypto::KeyManager keys; for (const auto& ticket_file : files) { + if (ticket_file == nullptr) { + continue; + } + if (ticket_file->GetExtension() != "tik") { continue; } - if (ticket_file == nullptr || - ticket_file->GetSize() < - Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET + sizeof(Core::Crypto::Key128)) { + if (ticket_file->GetSize() < + Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET + sizeof(Core::Crypto::Key128)) { continue; } -- cgit v1.2.3