mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
altsvc: return error on dot-only name
Because it is a trailing dot that otherwise leads to a zero length name. Coverity CID 1638755. Closes #15986
This commit is contained in:
parent
e67e2bda5a
commit
81a25ba7a4
1 changed files with 6 additions and 5 deletions
11
lib/altsvc.c
11
lib/altsvc.c
|
|
@ -108,19 +108,20 @@ static struct altsvc *altsvc_createid(const char *srchost,
|
|||
return NULL;
|
||||
DEBUGASSERT(hlen);
|
||||
DEBUGASSERT(dlen);
|
||||
if(!hlen || !dlen) {
|
||||
if(!hlen || !dlen)
|
||||
/* bad input */
|
||||
free(as);
|
||||
return NULL;
|
||||
}
|
||||
goto error;
|
||||
if((hlen > 2) && srchost[0] == '[') {
|
||||
/* IPv6 address, strip off brackets */
|
||||
srchost++;
|
||||
hlen -= 2;
|
||||
}
|
||||
else if(srchost[hlen - 1] == '.')
|
||||
else if(srchost[hlen - 1] == '.') {
|
||||
/* strip off trailing dot */
|
||||
hlen--;
|
||||
if(!hlen)
|
||||
goto error;
|
||||
}
|
||||
if((dlen > 2) && dsthost[0] == '[') {
|
||||
/* IPv6 address, strip off brackets */
|
||||
dsthost++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue