* Don't attempt to evaluate (ptr-1) when ptr is already at the beginning of the buffer.
authorArt Cancro <ajc@citadel.org>
Fri, 17 Apr 2009 16:46:34 +0000 (16:46 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 17 Apr 2009 16:46:34 +0000 (16:46 +0000)
webcit/html2html.c

index c1c2b64a55a8283b87d92b939a6cb7c5cd114ecc..289a7e51f8aff421c4eb15022d46408aa683d8c2 100644 (file)
@@ -502,10 +502,10 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St
                 * so we don't turn things that look like URL's into
                 * links, when they're already links - or image sources.
                 */
-               if (*(ptr-1) == '<') {
+               if ((ptr > msg) && (*(ptr-1) == '<')) {
                        ++brak;
                }
-               if (*(ptr-1) == '>') {
+               if ((ptr > msg) && (*(ptr-1) == '>')) {
                        --brak;
                        if ((scriptlevel == 0) && (script_start_pos >= 0)) {
                                StrBufCutRight(converted_msg, StrLength(converted_msg) - script_start_pos);