aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-02-13 23:57:40 +0100
committerDaniel Stenberg <daniel@haxx.se>2014-02-13 23:57:40 +0100
commitd3d871cb4fe1512b689bb29cb49473cfcf91c684 (patch)
treef90fa28a5afb4fc404a2385677eb5301ee1fcccd
parentdb981b7b30c8ed35ebdeab198fdf52afd8f49433 (diff)
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
-rw-r--r--lib/escape.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/escape.c b/lib/escape.c
index aa7db2c5b..d7f8a8f54 100644
--- a/lib/escape.c
+++ b/lib/escape.c
@@ -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;
}