From 9778640a8429aa4d4c5858f2e8d24f4b3f35eca1 Mon Sep 17 00:00:00 2001 From: LillyJadeKatrin Date: Sat, 29 Apr 2023 00:05:32 -0400 Subject: [PATCH] Added Invalid Request Drop to AchievementManager Request This fixes a crash I found in the Request function of AchievementManager where under certain conditions init_request would return an api_request with null post data, and Post would crash if it attempted to access it. Now the function aborts before the Post and returns an INVALID_REQUEST response type. --- Source/Core/Core/AchievementManager.cpp | 2 ++ Source/Core/Core/AchievementManager.h | 1 + 2 files changed, 3 insertions(+) diff --git a/Source/Core/Core/AchievementManager.cpp b/Source/Core/Core/AchievementManager.cpp index ac9d041b62..2b6015f382 100644 --- a/Source/Core/Core/AchievementManager.cpp +++ b/Source/Core/Core/AchievementManager.cpp @@ -384,6 +384,8 @@ AchievementManager::ResponseType AchievementManager::Request( rc_api_request_t api_request; Common::HttpRequest http_request; init_request(&api_request, &rc_request); + if (!api_request.post_data) + return ResponseType::INVALID_REQUEST; auto http_response = http_request.Post(api_request.url, api_request.post_data); rc_api_destroy_request(&api_request); if (http_response.has_value() && http_response->size() > 0) diff --git a/Source/Core/Core/AchievementManager.h b/Source/Core/Core/AchievementManager.h index b759386721..b5cf465915 100644 --- a/Source/Core/Core/AchievementManager.h +++ b/Source/Core/Core/AchievementManager.h @@ -26,6 +26,7 @@ public: { SUCCESS, MANAGER_NOT_INITIALIZED, + INVALID_REQUEST, INVALID_CREDENTIALS, CONNECTION_FAILED, UNKNOWN_FAILURE