1
0
mirror of https://github.com/leethomason/tinyxml2.git synced 2026-07-29 15:13:01 +04:00

Merge pull request #1011 from leethomason/leethomason/charref2

Defensive check for UTF conversion
This commit is contained in:
Lee Thomason
2024-12-09 21:47:05 -08:00
committed by GitHub
+5
View File
@@ -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;