Skip to content

Commit

Permalink
Fix buffer overflow when handling tabs (Issue #529)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Sep 4, 2024
1 parent 2d5b2ab commit 683bec5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Updated configure script to look for zlib with pkg-config (Issue #519)
- Updated markdown support code to mmd.
- Fixed handling of whitespace-only nodes (Issue #528)
- Fixed handling of tabs in PRE nodes (Issue #529)


# Changes in HTMLDOC v1.9.18
Expand Down
6 changes: 5 additions & 1 deletion htmldoc/ps-pdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5669,10 +5669,13 @@ parse_pre(tree_t *t, /* I - Tree to parse */

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) */
Expand All @@ -5687,6 +5690,7 @@ parse_pre(tree_t *t, /* I - Tree to parse */
*lineptr++ = *dataptr;
col ++;
}
}

*lineptr = '\0';

Expand Down

0 comments on commit 683bec5

Please sign in to comment.