Skip to content

Commit

Permalink
another defensive check
Browse files Browse the repository at this point in the history
  • Loading branch information
leethomason committed Dec 10, 2024
1 parent 4cbb251 commit 1fadaae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tinyxml2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,11 @@ const char* XMLUtil::GetCharacterRef(const char* p, char* value, int* length)
}
// convert the UCS to UTF-8
ConvertUTF32ToUTF8(ucs, value, length);
if (length == 0) {
// If length is 0, there was an error. (Security? Bad input?)
// Fail safely.
return 0;
}
return p + delta + 1;
}
return p + 1;
Expand Down

0 comments on commit 1fadaae

Please sign in to comment.