]> granicus.if.org Git - cgit/commitdiff
Test for NULL-pointers in html_txt() and friends
authorLars Hjemli <hjemli@gmail.com>
Thu, 28 Dec 2006 00:54:43 +0000 (01:54 +0100)
committerLars Hjemli <hjemli@gmail.com>
Thu, 28 Dec 2006 00:54:43 +0000 (01:54 +0100)
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
html.c

diff --git a/html.c b/html.c
index 957b3268be1a49a5a1d336d3412a4e71d4ca5959..3a5d28d9f7a255320b05755f2e42bc5aec7e520d 100644 (file)
--- 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);
 }
-