Unidiff1 files changed, 5 insertions, 4 deletions
|
diff --git a/html.c b/html.c index 337baeb..eaabf72 100644 --- a/ html.c+++ b/ html.c |
|
@@ -269,6 +269,7 @@ int hextoint(char c) |
269 | char *convert_query_hexchar(char *txt) |
269 | char *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; |
@@ -277,9 +278,9 @@ char *convert_query_hexchar(char *txt) |
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 | } |
|