diff options
author | Hiroki Hattori | 2008-02-24 02:57:34 +0900 |
---|---|---|
committer | Lars Hjemli | 2008-02-23 20:11:59 +0100 |
commit | eacde43d7184452e1fdc90b982b531f1f5239923 (patch) | |
tree | d2cc9342fd96a7c5a7287b708d958631a446d274 | |
parent | b74cc91574a9284d2f6446fd2ef3df6298ed6992 (diff) | |
download | cgit-eacde43d7184452e1fdc90b982b531f1f5239923.tar.gz cgit-eacde43d7184452e1fdc90b982b531f1f5239923.tar.bz2 cgit-eacde43d7184452e1fdc90b982b531f1f5239923.zip |
Fix segfault
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | html.c | 20 |
1 files changed, 5 insertions, 15 deletions
@@ -48,9 +48,7 @@ void html_txt(char *txt) | |||
48 | while(t && *t){ | 48 | while(t && *t){ |
49 | int c = *t; | 49 | int c = *t; |
50 | if (c=='<' || c=='>' || c=='&') { | 50 | if (c=='<' || c=='>' || c=='&') { |
51 | *t = '\0'; | 51 | write(htmlfd, txt, t - txt); |
52 | html(txt); | ||
53 | *t = c; | ||
54 | if (c=='>') | 52 | if (c=='>') |
55 | html(">"); | 53 | html(">"); |
56 | else if (c=='<') | 54 | else if (c=='<') |
@@ -71,9 +69,7 @@ void html_ntxt(int len, char *txt) | |||
71 | while(t && *t && len--){ | 69 | while(t && *t && len--){ |
72 | int c = *t; | 70 | int c = *t; |
73 | if (c=='<' || c=='>' || c=='&') { | 71 | if (c=='<' || c=='>' || c=='&') { |
74 | *t = '\0'; | 72 | write(htmlfd, txt, t - txt); |
75 | html(txt); | ||
76 | *t = c; | ||
77 | if (c=='>') | 73 | if (c=='>') |
78 | html(">"); | 74 | html(">"); |
79 | else if (c=='<') | 75 | else if (c=='<') |
@@ -84,12 +80,8 @@ void html_ntxt(int len, char *txt) | |||
84 | } | 80 | } |
85 | t++; | 81 | t++; |
86 | } | 82 | } |
87 | if (t!=txt) { | 83 | if (t!=txt) |
88 | char c = *t; | 84 | write(htmlfd, txt, t - txt); |
89 | *t = '\0'; | ||
90 | html(txt); | ||
91 | *t = c; | ||
92 | } | ||
93 | if (len<0) | 85 | if (len<0) |
94 | html("..."); | 86 | html("..."); |
95 | } | 87 | } |
@@ -100,9 +92,7 @@ void html_attr(char *txt) | |||
100 | while(t && *t){ | 92 | while(t && *t){ |
101 | int c = *t; | 93 | int c = *t; |
102 | if (c=='<' || c=='>' || c=='\'') { | 94 | if (c=='<' || c=='>' || c=='\'') { |
103 | *t = '\0'; | 95 | write(htmlfd, txt, t - txt); |
104 | html(txt); | ||
105 | *t = c; | ||
106 | if (c=='>') | 96 | if (c=='>') |
107 | html(">"); | 97 | html(">"); |
108 | else if (c=='<') | 98 | else if (c=='<') |