Curl_urldecode: don't allow NULL as receiver

For a function that returns a decoded version of a string, it seems
really strange to allow a NULL pointer to get passed in which then
prevents the decoded data from being returned!

This functionality was not documented anywhere either.

If anyone would use it that way, that memory would've been leaked.

Bug: https://github.com/bagder/curl/pull/90
Reported-by: Arvid Norberg
This commit is contained in:
Daniel Stenberg 2014-02-13 23:57:40 +01:00
parent db981b7b30
commit d3d871cb4f
1 changed files with 3 additions and 4 deletions

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -196,9 +196,8 @@ CURLcode Curl_urldecode(struct SessionHandle *data,
/* store output size */
*olen = strindex;
if(ostring)
/* store output string */
*ostring = ns;
/* store output string */
*ostring = ns;
return CURLE_OK;
}