diff --git a/code/ParsingUtils.h b/code/ParsingUtils.h index 25495fd51..93a44d0a6 100644 --- a/code/ParsingUtils.h +++ b/code/ParsingUtils.h @@ -201,7 +201,12 @@ template AI_FORCE_INLINE bool TokenMatch(char_t*& in, const char* token, unsigned int len) { if (!::strncmp(token,in,len) && IsSpaceOrNewLine(in[len])) { - in += len+1; + if (in[len] != '\0') { + in += len+1; + } else { + // If EOF after the token make sure we don't go past end of buffer + in += len; + } return true; }