* html_to_ascii(): don't buffer underrun while checking whether we should append...
[citadel.git] / libcitadel / lib / html_to_ascii.c
index 90d1103f56e5dbfc629c4c2ca52268978d720b0a..86cbdedeed4574c0fb0f8e67de99354e06644f5e 100644 (file)
@@ -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;
        }