From 2829c7ffde1ac1a6270a4dfab2b70fbc289e3c55 Mon Sep 17 00:00:00 2001 From: Artem Golubikhin Date: Mon, 9 Oct 2017 18:06:05 +0300 Subject: [PATCH] Fixed saving temporary string in PF_lightstyle_I (#532) Fixed saving temporary string in PF_lightstyle_I Marked mismatched code (HLTV) Fixed lightstyle copying in ParseSaveTables (SinglePlayer) --- rehlds/HLTV/Core/src/World.cpp | 7 +++++++ rehlds/HLTV/Core/src/World.h | 1 + rehlds/common/qlimits.h | 1 + rehlds/engine/host_cmd.cpp | 12 ++++++++---- rehlds/engine/host_cmd.h | 2 +- rehlds/engine/pr_cmds.cpp | 5 +++++ rehlds/engine/server.h | 2 ++ 7 files changed, 25 insertions(+), 5 deletions(-) diff --git a/rehlds/HLTV/Core/src/World.cpp b/rehlds/HLTV/Core/src/World.cpp index 8fb764f..3d232d7 100644 --- a/rehlds/HLTV/Core/src/World.cpp +++ b/rehlds/HLTV/Core/src/World.cpp @@ -353,6 +353,13 @@ void World::AddLightStyle(int index, char *style) m_System->Printf("WARNING! World::SetLightStyle: style too long (%i).\n", length); } + // FIXME: code mismatch + // Original code: + // Q_strncopy(..., 64); + // ...[63] = '\0'; + // Current code: + // Q_strncopy(..., 64); + // ...[64] = '\0'; Q_strlcpy(m_Lightstyles[index], style); } diff --git a/rehlds/HLTV/Core/src/World.h b/rehlds/HLTV/Core/src/World.h index b0c6aa9..3f0030f 100644 --- a/rehlds/HLTV/Core/src/World.h +++ b/rehlds/HLTV/Core/src/World.h @@ -251,6 +251,7 @@ protected: entity_state_t m_Instanced_BaseLines[MAX_INSTANCED_BASELINES]; int m_MaxInstanced_BaseLine; + // TODO: wtf, why 65? here should be 64 char m_Lightstyles[MAX_LIGHTSTYLES][65]; movevars_t m_MoveVars; diff --git a/rehlds/common/qlimits.h b/rehlds/common/qlimits.h index c19e670..1a67bd5 100644 --- a/rehlds/common/qlimits.h +++ b/rehlds/common/qlimits.h @@ -24,6 +24,7 @@ #define MAX_LIGHTSTYLE_INDEX_BITS 6 #define MAX_LIGHTSTYLES (1<