From 6b07da8c926015314e94ee608b9133830dcbe2fe Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 24 May 2011 21:55:08 +0000 Subject: [PATCH] fix possible NULL pointer access, thanks to the CLANG static analyser. --- webcit/html2html.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/webcit/html2html.c b/webcit/html2html.c index 4185b1fed..b91218b21 100644 --- a/webcit/html2html.c +++ b/webcit/html2html.c @@ -529,17 +529,19 @@ 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 > msg) && (*(ptr-1) == '<')) { + if ((ptr != NULL) && (ptr > msg) && (*(ptr-1) == '<')) { ++brak; } - if ((ptr > msg) && (*(ptr-1) == '>')) { + if ((ptr != NULL) && (ptr > msg) && (*(ptr-1) == '>')) { --brak; if ((scriptlevel == 0) && (script_start_pos >= 0)) { StrBufCutRight(converted_msg, StrLength(converted_msg) - script_start_pos); script_start_pos = (-1); } } - if (!strncasecmp(ptr, "", 3)) --alevel; + if ((ptr != NULL) && + !strncasecmp(ptr, "", 3)) + --alevel; } } -- 2.39.2