diff options
| author | 2018-10-03 02:06:26 -0400 | |
|---|---|---|
| committer | 2018-10-03 02:06:30 -0400 | |
| commit | dade709f6347ca3b27a0577efc25adae8e89bcf8 (patch) | |
| tree | 87354e6c2e7c117eebdc762f7d8976991b7ad0a4 /src | |
| parent | submission_package: Use std::string's rfind() when looking for the extension ... (diff) | |
| download | yuzu-dade709f6347ca3b27a0577efc25adae8e89bcf8.tar.gz yuzu-dade709f6347ca3b27a0577efc25adae8e89bcf8.tar.xz yuzu-dade709f6347ca3b27a0577efc25adae8e89bcf8.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/submission_package.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
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<VirtualFile>& files) { | |||
| 23 | Core::Crypto::KeyManager keys; | 23 | Core::Crypto::KeyManager keys; |
| 24 | 24 | ||
| 25 | for (const auto& ticket_file : files) { | 25 | for (const auto& ticket_file : files) { |
| 26 | if (ticket_file == nullptr) { | ||
| 27 | continue; | ||
| 28 | } | ||
| 29 | |||
| 26 | if (ticket_file->GetExtension() != "tik") { | 30 | if (ticket_file->GetExtension() != "tik") { |
| 27 | continue; | 31 | continue; |
| 28 | } | 32 | } |
| 29 | 33 | ||
| 30 | if (ticket_file == nullptr || | 34 | if (ticket_file->GetSize() < |
| 31 | ticket_file->GetSize() < | 35 | Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET + sizeof(Core::Crypto::Key128)) { |
| 32 | Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET + sizeof(Core::Crypto::Key128)) { | ||
| 33 | continue; | 36 | continue; |
| 34 | } | 37 | } |
| 35 | 38 | ||