aboutsummaryrefslogtreecommitdiffstats
path: root/html.c
diff options
context:
space:
mode:
authorLars Hjemli2010-08-29 17:40:51 +0200
committerLars Hjemli2010-08-29 17:40:51 +0200
commit6940b23b9e4698ba466a4616e4de77b986560ad3 (patch)
tree69dc61393b834474a8556d7b3969b327d223dc15 /html.c
parent6d7552bc072599313ef423d69156d824c075572a (diff)
parent48434780ca62fde84337ea1e797f642de5ca50d5 (diff)
downloadcgit-6940b23b9e4698ba466a4616e4de77b986560ad3.tar.gz
cgit-6940b23b9e4698ba466a4616e4de77b986560ad3.tar.bz2
cgit-6940b23b9e4698ba466a4616e4de77b986560ad3.zip
Merge branch 'stable'
Diffstat (limited to 'html.c')
-rw-r--r--html.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/html.c b/html.c
index 337baeb..eaabf72 100644
--- a/html.c
+++ b/html.c
@@ -268,19 +268,20 @@ int hextoint(char c)
268 268
269char *convert_query_hexchar(char *txt) 269char *convert_query_hexchar(char *txt)
270{ 270{
271 int d1, d2; 271 int d1, d2, n;
272 if (strlen(txt) < 3) { 272 n = strlen(txt);
273 if (n < 3) {
273 *txt = '\0'; 274 *txt = '\0';
274 return txt-1; 275 return txt-1;
275 } 276 }
276 d1 = hextoint(*(txt+1)); 277 d1 = hextoint(*(txt+1));
277 d2 = hextoint(*(txt+2)); 278 d2 = hextoint(*(txt+2));
278 if (d1<0 || d2<0) { 279 if (d1<0 || d2<0) {
279 strcpy(txt, txt+3); 280 memmove(txt, txt+3, n-3);
280 return txt-1; 281 return txt-1;
281 } else { 282 } else {
282 *txt = d1 * 16 + d2; 283 *txt = d1 * 16 + d2;
283 strcpy(txt+1, txt+3); 284 memmove(txt+1, txt+3, n-2);
284 return txt; 285 return txt;
285 } 286 }
286} 287}