mirror of
https://github.com/curl/curl.git
synced 2025-09-21 03:22:41 +03:00
cookie: get_top_domain() sets zero length for null domains
This silents a compilation warning with gcc -O3.
This commit is contained in:
parent
a75f12768d
commit
06a1b82140
|
@ -245,12 +245,10 @@ pathmatched:
|
||||||
*/
|
*/
|
||||||
static const char *get_top_domain(const char * const domain, size_t *outlen)
|
static const char *get_top_domain(const char * const domain, size_t *outlen)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len = 0;
|
||||||
const char *first = NULL, *last;
|
const char *first = NULL, *last;
|
||||||
|
|
||||||
if(!domain)
|
if(domain) {
|
||||||
return NULL;
|
|
||||||
|
|
||||||
len = strlen(domain);
|
len = strlen(domain);
|
||||||
last = memrchr(domain, '.', len);
|
last = memrchr(domain, '.', len);
|
||||||
if(last) {
|
if(last) {
|
||||||
|
@ -258,6 +256,7 @@ static const char *get_top_domain(const char * const domain, size_t *outlen)
|
||||||
if(first)
|
if(first)
|
||||||
len -= (++first - domain);
|
len -= (++first - domain);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(outlen)
|
if(outlen)
|
||||||
*outlen = len;
|
*outlen = len;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user