From 638c4014a1da1e2cff4000f4c6b64c7b75314055 Mon Sep 17 00:00:00 2001 From: Squall Leonhart Date: Sat, 23 Sep 2023 03:20:22 +1000 Subject: [PATCH] nn_olv: Handle nullptr key in SetSearchKey (#974) --- src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h b/src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h index e6078a7a..62dad755 100644 --- a/src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h +++ b/src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h @@ -531,6 +531,11 @@ namespace nn // SetSearchKey__Q3_2nn3olv25DownloadPostDataListParamFPCwUc static nnResult SetSearchKey(DownloadPostDataListParam* _this, const uint16be* searchKey, uint8 searchKeyIndex) { + if( !searchKey ) + { + memset(&_this->searchKeyArray[searchKeyIndex], 0, sizeof(SearchKey)); + return OLV_RESULT_SUCCESS; + } if (searchKeyIndex >= MAX_NUM_SEARCH_KEY) return OLV_RESULT_INVALID_PARAMETER; memset(&_this->searchKeyArray[searchKeyIndex], 0, sizeof(SearchKey)); @@ -546,6 +551,11 @@ namespace nn // SetSearchKey__Q3_2nn3olv25DownloadPostDataListParamFPCw static nnResult SetSearchKeySingle(DownloadPostDataListParam* _this, const uint16be* searchKey) { + if (searchKey == nullptr) + { + cemuLog_logDebug(LogType::NN_OLV, "DownloadPostDataListParam::SetSearchKeySingle: searchKeySingle is Null\n"); + return OLV_RESULT_INVALID_PARAMETER; + } return SetSearchKey(_this, searchKey, 0); }