summaryrefslogtreecommitdiff
path: root/lib/escape.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/escape.c')
-rw-r--r--lib/escape.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/escape.c b/lib/escape.c
index 274cd2dcd..6ac8847a6 100644
--- a/lib/escape.c
+++ b/lib/escape.c
@@ -81,16 +81,15 @@ char *curl_escape(char *string)
return ns;
}
-char *curl_unescape(char *string)
+char *curl_unescape(char *string, int length)
{
- int alloc = strlen(string)+1;
+ int alloc = (length?length:strlen(string))+1;
char *ns = malloc(alloc);
unsigned char in;
int index=0;
int hex;
-
-
- while(*string) {
+
+ while(--alloc) {
in = *string;
if('+' == in)
in = ' ';