diff --git a/lib/strutil/strutil8bit.c b/lib/strutil/strutil8bit.c index 6ff4f8aaf..29bc56fc9 100644 --- a/lib/strutil/strutil8bit.c +++ b/lib/strutil/strutil8bit.c @@ -338,6 +338,8 @@ str_8bit_fit_to_term (const char *text, int width, align_crt_t just_mode) } finally: + if (actual >= result + sizeof (result)) + actual = result + sizeof (result) - 1; actual[0] = '\0'; return result; }