File htmldoc-CVE-2024-46478.patch of Package htmldoc.openSUSE_Backports_SLE-15-SP6_Update
From 683bec548e642cf4a17e003fb34f6bbaf2d27b98 Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Wed, 4 Sep 2024 11:46:41 -0400
Subject: [PATCH] Fix buffer overflow when handling tabs (Issue #529)
---
CHANGES.md | 1 +
htmldoc/ps-pdf.cxx | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
Index: htmldoc-1.9.16/htmldoc/ps-pdf.cxx
===================================================================
--- htmldoc-1.9.16.orig/htmldoc/ps-pdf.cxx
+++ htmldoc-1.9.16/htmldoc/ps-pdf.cxx
@@ -5695,10 +5695,13 @@ parse_pre(tree_t *t, /* I - Tree to par
case MARKUP_NONE :
for (lineptr = line, dataptr = start->data;
- *dataptr != '\0' && lineptr < (line + sizeof(line) - 1);
+ *dataptr != '\0' && lineptr < (line + sizeof(line) - 9);
dataptr ++)
+ {
if (*dataptr == '\n')
+ {
break;
+ }
else if (*dataptr == '\t')
{
/* This code changed after 15 years to work around new compiler optimization bugs (Issue #349) */
@@ -5713,6 +5716,7 @@ parse_pre(tree_t *t, /* I - Tree to par
*lineptr++ = *dataptr;
col ++;
}
+ }
*lineptr = '\0';