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

[CVE-2024-34459] Fix buffer overread with xmllint --htmlout

Add a missing bounds check.

Fixes #720.
This commit is contained in:
Nick Wellnhofer 2024-05-08 11:49:31 +02:00
parent c83147bff2
commit 3ad7f81624

View File

@ -543,7 +543,7 @@ xmlHTMLPrintFileContext(xmlParserInputPtr input) {
len = strlen(buffer);
snprintf(&buffer[len], sizeof(buffer) - len, "\n");
cur = input->cur;
while ((*cur == '\n') || (*cur == '\r'))
while ((cur > base) && ((*cur == '\n') || (*cur == '\r')))
cur--;
n = 0;
while ((cur != base) && (n++ < 80)) {