X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fdotdot.c;h=99fac7f9893e99dd61d8fe51c4b0f2d0ff331b1b;hb=0a710b32648c435f792f5993fdefa2d96f802580;hp=ae169411deeefdb6e7de0b28d260c6c3d39321c2;hpb=7b6dca47a42828c0ae87eab0d8b68f97d1495b67;p=platform%2Fupstream%2Fcurl.git diff --git a/lib/dotdot.c b/lib/dotdot.c index ae16941..99fac7f 100644 --- a/lib/dotdot.c +++ b/lib/dotdot.c @@ -5,11 +5,11 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, 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 - * 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 @@ -30,11 +30,12 @@ /* * "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 +69,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