From d3d871cb4fe1512b689bb29cb49473cfcf91c684 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 13 Feb 2014 23:57:40 +0100 Subject: 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 --- lib/escape.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/escape.c') 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, , et al. + * Copyright (C) 1998 - 2014, Daniel Stenberg, , 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; } -- cgit v1.2.1