From aaf8e6aba9c58c221f14dd791f6c683af9fa2374 Mon Sep 17 00:00:00 2001 From: JerryALT Date: Mon, 10 Jun 2024 22:53:28 +0300 Subject: [PATCH] [TextRenderer]: Fixed crash in DrawPlayerWeaponLowAmmoWarning --- src/Components/Modules/TextRenderer.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Components/Modules/TextRenderer.cpp b/src/Components/Modules/TextRenderer.cpp index f7e0da9..3bfc1cb 100644 --- a/src/Components/Modules/TextRenderer.cpp +++ b/src/Components/Modules/TextRenderer.cpp @@ -187,7 +187,7 @@ namespace Components { char binding[256]; if (!Game::UI_GetKeyBindingLocalizedString(0, "+usereload", binding, 0)) - std::strncpy(binding, "", sizeof(binding)); + strncpy_s(binding, sizeof(binding), "", _TRUNCATE); const char* displayString = Game::UI_SafeTranslateString(pszInputBuffer); const char* localizedString = Game::UI_ReplaceConversionString(displayString, binding); @@ -196,16 +196,10 @@ namespace Components __declspec(naked) void TextRenderer::CG_DrawPlayerWeaponLowAmmoWarningStub() { - const static uint32_t jump_offset = 0x040A1F0; - static const char* messageType = "low ammo warning"; + const static uint32_t jump_offset = 0x40A1F0; __asm { - push 0; - push messageType; - push esi; call CG_DrawPlayerWeaponLowAmmoKey; - add esp, 0xC; - jmp jump_offset; } }