From 27cd3b2a700e1cc46cd0393ddea48c07b62ee3a6 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Thu, 28 Dec 2006 01:54:43 +0100 Subject: Test for NULL-pointers in html_txt() and friends Signed-off-by: Lars Hjemli --- html.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'html.c') diff --git a/html.c b/html.c index 957b326..3a5d28d 100644 --- a/html.c +++ b/html.c @@ -45,7 +45,7 @@ void htmlf(const char *format, ...) void html_txt(char *txt) { char *t = txt; - while(*t){ + while(t && *t){ int c = *t; if (c=='<' || c=='>' || c=='&') { *t = '\0'; @@ -68,7 +68,7 @@ void html_txt(char *txt) void html_ntxt(int len, char *txt) { char *t = txt; - while(*t && len--){ + while(t && *t && len--){ int c = *t; if (c=='<' || c=='>' || c=='&') { *t = '\0'; @@ -97,7 +97,7 @@ void html_ntxt(int len, char *txt) void html_attr(char *txt) { char *t = txt; - while(*t){ + while(t && *t){ int c = *t; if (c=='<' || c=='>' || c=='\'') { *t = '\0'; @@ -155,4 +155,3 @@ void html_filemode(unsigned short mode) html_fileperm(mode >> 3); html_fileperm(mode); } - -- cgit v1.2.3-24-g4f1b