aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/html.c
diff options
context:
space:
mode:
authorHiroki Hattori2008-02-24 02:57:34 +0900
committerLars Hjemli2008-02-23 20:11:59 +0100
commiteacde43d7184452e1fdc90b982b531f1f5239923 (patch)
treed2cc9342fd96a7c5a7287b708d958631a446d274 /html.c
parentb74cc91574a9284d2f6446fd2ef3df6298ed6992 (diff)
downloadcgit-eacde43d7184452e1fdc90b982b531f1f5239923.tar
cgit-eacde43d7184452e1fdc90b982b531f1f5239923.tar.gz
cgit-eacde43d7184452e1fdc90b982b531f1f5239923.zip
Fix segfault
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'html.c')
-rw-r--r--html.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/html.c b/html.c
index 6c9cc8b..d531c20 100644
--- a/html.c
+++ b/html.c
@@ -48,9 +48,7 @@ void html_txt(char *txt)
while(t && *t){
int c = *t;
if (c=='<' || c=='>' || c=='&') {
- *t = '\0';
- html(txt);
- *t = c;
+ write(htmlfd, txt, t - txt);
if (c=='>')
html("&gt;");
else if (c=='<')
@@ -71,9 +69,7 @@ void html_ntxt(int len, char *txt)
while(t && *t && len--){
int c = *t;
if (c=='<' || c=='>' || c=='&') {
- *t = '\0';
- html(txt);
- *t = c;
+ write(htmlfd, txt, t - txt);
if (c=='>')
html("&gt;");
else if (c=='<')
@@ -84,12 +80,8 @@ void html_ntxt(int len, char *txt)
}
t++;
}
- if (t!=txt) {
- char c = *t;
- *t = '\0';
- html(txt);
- *t = c;
- }
+ if (t!=txt)
+ write(htmlfd, txt, t - txt);
if (len<0)
html("...");
}
@@ -100,9 +92,7 @@ void html_attr(char *txt)
while(t && *t){
int c = *t;
if (c=='<' || c=='>' || c=='\'') {
- *t = '\0';
- html(txt);
- *t = c;
+ write(htmlfd, txt, t - txt);
if (c=='>')
html("&gt;");
else if (c=='<')