From 151d98df51d2320682082608818c9e70c99c5e72 Mon Sep 17 00:00:00 2001 From: shinra-electric <50119606+shinra-electric@users.noreply.github.com> Date: Sat, 8 Oct 2022 23:01:41 +0200 Subject: [PATCH] Update based on feedback by GovanifY --- 3rdparty/pine/pine_server.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/3rdparty/pine/pine_server.h b/3rdparty/pine/pine_server.h index f4f254c9a0..94ae4a9019 100644 --- a/3rdparty/pine/pine_server.h +++ b/3rdparty/pine/pine_server.h @@ -267,7 +267,6 @@ namespace pine char version[256] = {}; snprintf(version, sizeof(version), "RPCS3 %s", Impl::get_version_and_branch().c_str()); const u32 size = strlen(version) + 1; - version[size] = 0x00; if (!SafetyChecks(buf_cnt, 0, ret_cnt, size + 4, buf_size)) goto error; ToArray(ret_buffer, size, ret_cnt); @@ -291,8 +290,7 @@ namespace pine const auto title_string = Impl::get_title(); const auto size = title_string.size() + 1; char* title = new char[size]; - snprintf(title, sizeof(title), "%s", title_string.c_str()); - title[size] = 0x00; + snprintf(title, size, "%s", title_string.c_str()); if (!SafetyChecks(buf_cnt, 0, ret_cnt, size + 4, buf_size)) goto error; ToArray(ret_buffer, size, ret_cnt); @@ -307,8 +305,7 @@ namespace pine const auto title_id_string = Impl::get_title_ID(); const auto size = title_id_string.size() + 1; char* title_id = new char[size]; - snprintf(title_id, sizeof(title_id), "%s", title_id_string.c_str()); - title_id[size] = 0x00; + snprintf(title_id, size, "%s", title_id_string.c_str()); if (!SafetyChecks(buf_cnt, 0, ret_cnt, size + 4, buf_size)) goto error; ToArray(ret_buffer, size, ret_cnt); @@ -323,8 +320,7 @@ namespace pine const auto hash_string = Impl::get_executable_hash(); const auto size = hash_string.size() + 1; char* hash = new char[size]; - snprintf(hash, sizeof(hash), "%s", hash_string.c_str()); - hash[size] = 0x00; + snprintf(hash, size, "%s", hash_string.c_str()); if (!SafetyChecks(buf_cnt, 0, ret_cnt, size + 4, buf_size)) goto error; ToArray(ret_buffer, size, ret_cnt); @@ -339,8 +335,7 @@ namespace pine const auto game_version_string = Impl::get_app_version(); const auto size = game_version_string.size() + 1; char* game_version = new char[size]; - snprintf(game_version, sizeof(game_version), "%s", game_version_string.c_str()); - game_version[size] = 0x00; + snprintf(game_version, size, "%s", game_version_string.c_str()); if (!SafetyChecks(buf_cnt, 0, ret_cnt, size, buf_size)) goto error; ToArray(ret_buffer, size, ret_cnt);