Skip to content

Commit

Permalink
[CVE-2024-34459] Fix buffer overread with xmllint --htmlout
Browse files Browse the repository at this point in the history
Add a missing bounds check.

Fixes #720.
  • Loading branch information
nwellnhof committed May 13, 2024
1 parent c83147b commit 3ad7f81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xmllint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 3ad7f81

Please sign in to comment.