Skip to content

Commit

Permalink
fixup parse_hostname_login() to use the host length
Browse files Browse the repository at this point in the history
  • Loading branch information
bagder committed Apr 11, 2023
1 parent 4d909c3 commit ae8d594
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/urlapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ static bool junkscan(const char *part, unsigned int flags)
*/
static CURLUcode parse_hostname_login(struct Curl_URL *u,
const char *login,
size_t len,
unsigned int flags,
size_t *offset) /* to the host name */
{
Expand All @@ -428,7 +429,7 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u,

DEBUGASSERT(login);

ptr = strchr(login, '@');
ptr = memchr(login, '@', len);
if(!ptr)
goto out;

Expand Down Expand Up @@ -1129,7 +1130,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
/*
* Parse the login details and strip them out of the host name.
*/
result = parse_hostname_login(u, hostp, flags, &offset);
result = parse_hostname_login(u, hostp, hostlen, flags, &offset);
if(!result) {
hostp += offset;
hostlen -= offset;
Expand Down

0 comments on commit ae8d594

Please sign in to comment.