Skip to content

Commit

Permalink
Fix XMLDocument includes failing to parse if missing a closing quot…
Browse files Browse the repository at this point in the history
…e. (#1787, closes #1786)
  • Loading branch information
AMS21 authored Feb 7, 2025
1 parent 0f09f03 commit 41f709e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/xrCore/XML/XMLDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ ParseIncludeResult ParseInclude(pstr string, pcstr& out_include_name)
while (*string != '\0' && *string != '\"')
++string;

// Check for unterminated or empty include name
if (*string == '\0' || out_include_name == string)
// Check for empty include name
if (out_include_name == string)
return ParseIncludeResult::Error;

// Check for unreasonably long include names
Expand All @@ -59,8 +59,8 @@ ParseIncludeResult ParseInclude(pstr string, pcstr& out_include_name)
return ParseIncludeResult::Error;

// NOTE(Andre): Yes this might look scary but it's perfectly fine. Since the include name is already in the string
// we are parsing and its not used afterwards we simply replace the closing quote with a null byte and we have a
// valid c-string pointed to by 'out_include_name' and safe ourselves the need to copy the string.
// we are parsing and its not used afterwards we simply replace the closing quote (if there is one) with a null byte
// and we have a valid c-string pointed to by 'out_include_name' and safe ourselves the need to copy the string.
*string = '\0';

return ParseIncludeResult::Success;
Expand Down

0 comments on commit 41f709e

Please sign in to comment.