/* Let cookie-path be the default-path. */
return strdup("/");
- /* remove trailing slash */
+ /* remove trailing slash when path is non-empty */
/* convert /hoge/ to /hoge */
- if(len && cookie_path[len - 1] == '/')
+ if(len > 1 && cookie_path[len - 1] == '/')
len--;
return Curl_memdup0(cookie_path, len);
clist->spath && co->spath && /* both have paths */
clist->secure && !co->secure && !secure) {
size_t cllen;
- const char *sep;
+ const char *sep = NULL;
/*
* A non-secure cookie may not overlay an existing secure cookie.
* "/loginhelper" is ok.
*/
- sep = strchr(clist->spath + 1, '/');
-
+ DEBUGASSERT(clist->spath[0]);
+ if(clist->spath[0])
+ sep = strchr(clist->spath + 1, '/');
if(sep)
cllen = sep - clist->spath;
else