all repos — cgit @ 27cd3b2a700e1cc46cd0393ddea48c07b62ee3a6

a hyperfast web frontend for git written in c

Test for NULL-pointers in html_txt() and friends

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Thu, 28 Dec 2006 01:54:43 +0100
commit

27cd3b2a700e1cc46cd0393ddea48c07b62ee3a6

parent

c43f1246cb759eb811ab0ebef0613b86dda99581

1 files changed, 3 insertions(+), 4 deletions(-)

jump to
M html.chtml.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); } -