mirror of
https://github.com/moparisthebest/curl
synced 2024-11-04 16:45:06 -05: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
19
lib/cookie.c
19
lib/cookie.c
@ -245,18 +245,17 @@ pathmatched:
|
||||
*/
|
||||
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;
|
||||
|
||||
if(!domain)
|
||||
return NULL;
|
||||
|
||||
len = strlen(domain);
|
||||
last = memrchr(domain, '.', len);
|
||||
if(last) {
|
||||
first = memrchr(domain, '.', (last - domain));
|
||||
if(first)
|
||||
len -= (++first - domain);
|
||||
if(domain) {
|
||||
len = strlen(domain);
|
||||
last = memrchr(domain, '.', len);
|
||||
if(last) {
|
||||
first = memrchr(domain, '.', (last - domain));
|
||||
if(first)
|
||||
len -= (++first - domain);
|
||||
}
|
||||
}
|
||||
|
||||
if(outlen)
|
||||
|
Loading…
Reference in New Issue
Block a user