-rw-r--r-- | html.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -40,17 +40,17 @@ void htmlf(const char *format, ...) vsnprintf(buf, sizeof(buf), format, args); va_end(args); html(buf); } void html_txt(char *txt) { char *t = txt; - while(*t){ + while(t && *t){ int c = *t; if (c=='<' || c=='>' || c=='&') { *t = '\0'; html(txt); *t = c; if (c=='>') html(">"); else if (c=='<') @@ -63,17 +63,17 @@ void html_txt(char *txt) } if (t!=txt) html(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'; html(txt); *t = c; if (c=='>') html(">"); else if (c=='<') @@ -92,17 +92,17 @@ void html_ntxt(int len, char *txt) } if (len<0) html("..."); } void html_attr(char *txt) { char *t = txt; - while(*t){ + while(t && *t){ int c = *t; if (c=='<' || c=='>' || c=='\'') { *t = '\0'; html(txt); *t = c; if (c=='>') html(">"); else if (c=='<') @@ -150,9 +150,8 @@ void html_filemode(unsigned short mode) else if (S_ISLNK(mode)) html("l"); else html("-"); html_fileperm(mode >> 6); html_fileperm(mode >> 3); html_fileperm(mode); } - |