From 96dde76b99897352aa3d0877a0b621a9e605733e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 22 May 2000 14:12:12 +0000 Subject: moved here from the newlib branch --- lib/escape.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/escape.c') 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 = ' '; -- cgit v1.2.3