Author: Lars Hjemli <hjemli@gmail.com>
Test for NULL-pointers in html_txt() and friends Signed-off-by: Lars Hjemli <hjemli@gmail.com>
html.c | 7 +++----
diff --git a/html.c b/html.c index 957b3268be1a49a5a1d336d3412a4e71d4ca5959..3a5d28d9f7a255320b05755f2e42bc5aec7e520d 100644 --- a/html.c +++ b/html.c @@ -45,7 +45,7 @@ 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_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_attr(char *txt) { char *t = txt; - while(*t){ + while(t && *t){ int c = *t; if (c=='<' || c=='>' || c=='\'') { *t = '\0'; @@ -155,4 +155,3 @@ html_fileperm(mode >> 6); html_fileperm(mode >> 3); html_fileperm(mode); } -