From 47808b567d309fcdd6dc6ab10d379360cea1f23e Mon Sep 17 00:00:00 2001 From: Person Date: Mon, 4 Mar 2024 07:49:22 -0700 Subject: [PATCH] --Bug fixes -Attempt to fix a null termination bug when reading Xml strings. --- Source/Ember/Utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Ember/Utils.h b/Source/Ember/Utils.h index 7d81721..394515f 100644 --- a/Source/Ember/Utils.h +++ b/Source/Ember/Utils.h @@ -3,7 +3,7 @@ #include "Isaac.h" #ifndef _WIN32 -#define _strnicmp strncasecmp + #define _strnicmp strncasecmp #endif /// @@ -336,7 +336,7 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru ifs.seekg(0, ios::beg); ifs.read(&buf[0], pos); - if (nullTerminate)//Optionally NULL terminate if they want to treat it as a string. + if (nullTerminate && (buf[buf.size() - 1] != 0))//Optionally NULL terminate if they want to treat it as a string, and it's not terminated arleady. buf[buf.size() - 1] = 0; return true;