]> gitweb.ps.run Git - ps-cgit/commitdiff
Fix segfault
authorHiroki Hattori <seagull.kamome@gmail.com>
Sat, 23 Feb 2008 17:57:34 +0000 (02:57 +0900)
committerLars Hjemli <hjemli@gmail.com>
Sat, 23 Feb 2008 19:11:59 +0000 (20:11 +0100)
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
html.c

diff --git a/html.c b/html.c
index 6c9cc8b67342b6df67dc35b586cbdb622612c5ca..d531c209f2502ab43ceb36c749c69b7f4a93c3b1 100644 (file)
--- 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=='<')