lib/fetch: fix CVE-2020-7450
https://www.freebsd.org/security/advisories/FreeBSD-SA-20:01.libfetch.asc
This commit is contained in:
parent
40dd4deb4d
commit
57675c7dfc
@ -331,6 +331,8 @@ fetch_pctdecode(char *dst, const char *src, size_t dlen)
|
||||
}
|
||||
if (dlen-- > 0)
|
||||
*dst++ = c;
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
return (s);
|
||||
}
|
||||
@ -481,10 +483,14 @@ find_user:
|
||||
if (p != NULL && *p == '@') {
|
||||
/* username */
|
||||
q = fetch_pctdecode(u->user, URL, URL_USERLEN);
|
||||
if (q == NULL)
|
||||
goto ouch;
|
||||
/* password */
|
||||
if (*q == ':')
|
||||
if (*q == ':') {
|
||||
q = fetch_pctdecode(u->pwd, q + 1, URL_PWDLEN);
|
||||
|
||||
if (q == NULL)
|
||||
goto ouch;
|
||||
}
|
||||
p++;
|
||||
} else {
|
||||
p = URL;
|
||||
|
Loading…
Reference in New Issue
Block a user