Skip to content

Commit 683bec5

Browse files
committed
Fix buffer overflow when handling tabs (Issue #529)
1 parent 2d5b2ab commit 683bec5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Updated configure script to look for zlib with pkg-config (Issue #519)
66
- Updated markdown support code to mmd.
77
- Fixed handling of whitespace-only nodes (Issue #528)
8+
- Fixed handling of tabs in PRE nodes (Issue #529)
89

910

1011
# Changes in HTMLDOC v1.9.18

htmldoc/ps-pdf.cxx

+5-1
Original file line numberDiff line numberDiff line change
@@ -5669,10 +5669,13 @@ parse_pre(tree_t *t, /* I - Tree to parse */
56695669

56705670
case MARKUP_NONE :
56715671
for (lineptr = line, dataptr = start->data;
5672-
*dataptr != '\0' && lineptr < (line + sizeof(line) - 1);
5672+
*dataptr != '\0' && lineptr < (line + sizeof(line) - 9);
56735673
dataptr ++)
5674+
{
56745675
if (*dataptr == '\n')
5676+
{
56755677
break;
5678+
}
56765679
else if (*dataptr == '\t')
56775680
{
56785681
/* This code changed after 15 years to work around new compiler optimization bugs (Issue #349) */
@@ -5687,6 +5690,7 @@ parse_pre(tree_t *t, /* I - Tree to parse */
56875690
*lineptr++ = *dataptr;
56885691
col ++;
56895692
}
5693+
}
56905694

56915695
*lineptr = '\0';
56925696

0 commit comments

Comments
 (0)