1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

parser: Fix buffer overread in xmlDetectEBCDIC

Short-lived regression found by OSS-Fuzz.
This commit is contained in:
Nick Wellnhofer 2023-03-26 14:11:31 +02:00
parent 7fbd454d9f
commit 3660229219

View File

@ -1003,11 +1003,12 @@ xmlDetectEBCDIC(xmlParserInputPtr input) {
handler = xmlGetCharEncodingHandler(XML_CHAR_ENCODING_EBCDIC);
if (handler == NULL)
return(NULL);
outlen = sizeof(out);
outlen = sizeof(out) - 1;
inlen = input->end - input->cur;
res = xmlEncInputChunk(handler, out, &outlen, input->cur, &inlen, 0);
if (res < 0)
return(handler);
out[outlen] = 0;
for (i = 0; i < outlen; i++) {
if (out[i] == '>')