From: Wilfried Göesgens Date: Thu, 25 Mar 2010 22:53:51 +0000 (+0000) Subject: * html_to_ascii(): don't buffer underrun while checking whether we should append... X-Git-Tag: v7.86~286 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=e71b873f193234c0ad23d442cbeb0c68fbc0215b;p=citadel.git * html_to_ascii(): don't buffer underrun while checking whether we should append a trailing newline or not. --- diff --git a/libcitadel/lib/html_to_ascii.c b/libcitadel/lib/html_to_ascii.c index 90d1103f5..86cbdedee 100644 --- a/libcitadel/lib/html_to_ascii.c +++ b/libcitadel/lib/html_to_ascii.c @@ -570,7 +570,7 @@ char *html_to_ascii(char *inputmsg, int msglen, int screenwidth, int do_citaform --output_len; } - if (outptr[output_len-1] != '\n') { + if ((output_len > 0) && (outptr[output_len-1] != '\n')) { strcat(outptr, "\n"); ++output_len; }