diff --git a/CHANGES.md b/CHANGES.md index 9da53701..aa16f531 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/htmldoc/ps-pdf.cxx b/htmldoc/ps-pdf.cxx index 9ad44ebb..937d063c 100644 --- a/htmldoc/ps-pdf.cxx +++ b/htmldoc/ps-pdf.cxx @@ -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) */ @@ -5687,6 +5690,7 @@ parse_pre(tree_t *t, /* I - Tree to parse */ *lineptr++ = *dataptr; col ++; } + } *lineptr = '\0';