summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/dotdot.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-08-03 18:26:53 (GMT)
committerBrad King <brad.king@kitware.com>2016-08-03 18:26:53 (GMT)
commitf53f4a8a2d215dac634effea575a27e000dfcb29 (patch)
tree5782e71da9e12ab6081e47f8eaf8eeb908e1428a /Utilities/cmcurl/lib/dotdot.c
parente1c11352f231ae310339cd539ed59cb302bd4dbe (diff)
parent202adcfe056681109fe61569ecdb3bd69f0b4f97 (diff)
downloadCMake-f53f4a8a2d215dac634effea575a27e000dfcb29.zip
CMake-f53f4a8a2d215dac634effea575a27e000dfcb29.tar.gz
CMake-f53f4a8a2d215dac634effea575a27e000dfcb29.tar.bz2
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2016-08-03 (f2cb3a01)
Diffstat (limited to 'Utilities/cmcurl/lib/dotdot.c')
-rw-r--r--Utilities/cmcurl/lib/dotdot.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/Utilities/cmcurl/lib/dotdot.c b/Utilities/cmcurl/lib/dotdot.c
index ae16941..ea7c8a0 100644
--- a/Utilities/cmcurl/lib/dotdot.c
+++ b/Utilities/cmcurl/lib/dotdot.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, 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
- * are also available at http://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@@ -22,19 +22,22 @@
#include "curl_setup.h"
-#include "dotdot.h"
+#include <curl/curl.h>
+#include "dotdot.h"
#include "curl_memory.h"
+
/* The last #include file should be: */
#include "memdebug.h"
/*
* "Remove Dot Segments"
- * http://tools.ietf.org/html/rfc3986#section-5.2.4
+ * https://tools.ietf.org/html/rfc3986#section-5.2.4
*/
/*
* Curl_dedotdotify()
+ * @unittest: 1395
*
* This function gets a zero-terminated path with dot and dotdot sequences
* passed in and strips them off according to the rules in RFC 3986 section
@@ -68,6 +71,12 @@ char *Curl_dedotdotify(const char *input)
orgclone = clone;
outptr = out;
+ if(!*clone) {
+ /* zero length string, return that */
+ free(out);
+ return clone;
+ }
+
/*
* To handle query-parts properly, we must find it and remove it during the
* dotdot-operation and then append it again at the end to the output