Merge branch 'stable'

* stable:
  Fix segfault

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
Lars Hjemli 2008-02-23 20:13:57 +01:00
commit e0572c39f7

20
html.c
View File

@ -48,9 +48,7 @@ void html_txt(char *txt)
while(t && *t){ while(t && *t){
int c = *t; int c = *t;
if (c=='<' || c=='>' || c=='&') { if (c=='<' || c=='>' || c=='&') {
*t = '\0'; write(htmlfd, txt, t - txt);
html(txt);
*t = c;
if (c=='>') if (c=='>')
html("&gt;"); html("&gt;");
else if (c=='<') else if (c=='<')
@ -71,9 +69,7 @@ void html_ntxt(int len, char *txt)
while(t && *t && len--){ while(t && *t && len--){
int c = *t; int c = *t;
if (c=='<' || c=='>' || c=='&') { if (c=='<' || c=='>' || c=='&') {
*t = '\0'; write(htmlfd, txt, t - txt);
html(txt);
*t = c;
if (c=='>') if (c=='>')
html("&gt;"); html("&gt;");
else if (c=='<') else if (c=='<')
@ -84,12 +80,8 @@ void html_ntxt(int len, char *txt)
} }
t++; t++;
} }
if (t!=txt) { if (t!=txt)
char c = *t; write(htmlfd, txt, t - txt);
*t = '\0';
html(txt);
*t = c;
}
if (len<0) if (len<0)
html("..."); html("...");
} }
@ -100,9 +92,7 @@ void html_attr(char *txt)
while(t && *t){ while(t && *t){
int c = *t; int c = *t;
if (c=='<' || c=='>' || c=='\'') { if (c=='<' || c=='>' || c=='\'') {
*t = '\0'; write(htmlfd, txt, t - txt);
html(txt);
*t = c;
if (c=='>') if (c=='>')
html("&gt;"); html("&gt;");
else if (c=='<') else if (c=='<')