]> granicus.if.org Git - curl/commitdiff
Curl_urldecode: don't allow NULL as receiver
authorDaniel Stenberg <daniel@haxx.se>
Thu, 13 Feb 2014 22:57:40 +0000 (23:57 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 13 Feb 2014 22:57:40 +0000 (23:57 +0100)
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
lib/escape.c

index aa7db2c5b99d94287b4bac94c0b9be0ede22a2db..d7f8a8f5412802859599060ec26a5af79874d0bf 100644 (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;
 }