From d5cf0f31d13044b252790a59a54311beaa67b289 Mon Sep 17 00:00:00 2001 From: Squall-Leonhart Date: Fri, 22 Sep 2023 06:54:19 +1000 Subject: [PATCH 1/3] add null check to SetSearchKeySingle in nn_olv_PostTypes.h Added null check for searchKey in SetSearchKeySingle function to prevent exceptions when data is unavailable or incorrect. --- src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h | 4 ++++ 1 file changed, 4 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 e6078a7aa..4eb1bf10f 100644 --- a/src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h +++ b/src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h @@ -546,6 +546,10 @@ namespace nn // SetSearchKey__Q3_2nn3olv25DownloadPostDataListParamFPCw static nnResult SetSearchKeySingle(DownloadPostDataListParam* _this, const uint16be* searchKey) { + if (searchKey == NULL) + { + return OLV_RESULT_INVALID_PARAMETER; + } return SetSearchKey(_this, searchKey, 0); } From 6e5503ca3f3ebd7e298a48bb8f7b590b61853fac Mon Sep 17 00:00:00 2001 From: Squall-Leonhart Date: Fri, 22 Sep 2023 09:07:10 +1000 Subject: [PATCH 2/3] null > nullptr and logger entry no behavioral change, just more in lin with the rest of the file and C++ consistency. --- src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 4eb1bf10f..297e1a9d5 100644 --- a/src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h +++ b/src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h @@ -546,8 +546,9 @@ namespace nn // SetSearchKey__Q3_2nn3olv25DownloadPostDataListParamFPCw static nnResult SetSearchKeySingle(DownloadPostDataListParam* _this, const uint16be* searchKey) { - if (searchKey == NULL) + if (searchKey == nullptr) { + cemuLog_logDebug(LogType::NN_OLV, "DownloadPostDataListParam::SetSearchKeySingle: searchKeySingle is Null\n"); return OLV_RESULT_INVALID_PARAMETER; } return SetSearchKey(_this, searchKey, 0); From 2ad531b9c52720ba807975cdd9576514bd5f43a1 Mon Sep 17 00:00:00 2001 From: Squall-Leonhart Date: Fri, 22 Sep 2023 06:54:19 +1000 Subject: [PATCH 3/3] Updated SetSearchKey function to handle null search keys. Updated SetSearchKey function to handle null search keys. If a null search key is provided, the function now clears the search key at the specified index and returns success. --- src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h | 5 +++++ 1 file changed, 5 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 e6078a7aa..5109d9099 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));