From 73cf426409d3c9d097d650c7713c9d49d270623c Mon Sep 17 00:00:00 2001 From: Lukas Javorsky Date: Thu, 1 Aug 2024 10:47:02 +0200 Subject: [PATCH] Fix the possible overrun of buf array --- src/roff/troff/env.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp index 1b3b4ba..8b91380 100644 --- a/src/roff/troff/env.cpp +++ b/src/roff/troff/env.cpp @@ -4003,7 +4003,7 @@ void hyphenate(hyphen_list *h, unsigned flags) while (h && h->hyphenation_code == 0) h = h->next; int len = 0; - char hbuf[WORD_MAX + 2]; + char hbuf[WORD_MAX + 2 + 1]; char *buf = hbuf + 1; hyphen_list *tem; for (tem = h; tem && len < WORD_MAX; tem = tem->next) { @@ -4063,7 +4063,7 @@ void hyphenate(hyphen_list *h, unsigned flags) } else { hbuf[0] = hbuf[len + 1] = '.'; - int num[WORD_MAX + 3]; + int num[WORD_MAX + 3 + 1]; current_language->patterns.hyphenate(hbuf, len + 2, num); // The position of a hyphenation point gets marked with an odd // number. Example: -- 2.45.2