From 9eba17da94f634dc8d48b9092a25b68d4c64e9e7 Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on ChromeOS)" <rob@synchro.net> Date: Fri, 23 Jun 2023 17:48:35 -0700 Subject: [PATCH] Sanity-check the oldlen argument value to wordwrap() If the oldlen param value is less than one, set to a sane non-zero value (79). Fix issue #576 --- src/sbbs3/wordwrap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sbbs3/wordwrap.c b/src/sbbs3/wordwrap.c index d1d106265b..b4ffd18418 100644 --- a/src/sbbs3/wordwrap.c +++ b/src/sbbs3/wordwrap.c @@ -571,6 +571,8 @@ char* wordwrap(char* inbuf, int len, int oldlen, BOOL handle_quotes, BOOL is_utf struct paragraph *paragraphs; BOOL has_crs; + if (oldlen < 1) + oldlen = 79; paragraphs = word_unwrap(inbuf, oldlen, handle_quotes, &has_crs, is_utf8); if (paragraphs == NULL) return NULL; -- GitLab