diff options
author | Daniel Stenberg <daniel@haxx.se> | 2000-05-22 14:12:12 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2000-05-22 14:12:12 +0000 |
commit | 96dde76b99897352aa3d0877a0b621a9e605733e (patch) | |
tree | 4fdab47b4c9769405aa799bf65971c31abf2de6b /lib/escape.c | |
parent | fb9d1ff00f76836dd66725de869656c5fa53b071 (diff) |
moved here from the newlib branch
Diffstat (limited to 'lib/escape.c')
-rw-r--r-- | lib/escape.c | 9 |
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 = ' '; |