Skip to content

Commit

Permalink
fix a buffer overflow in libfetch
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Jan 28, 2020
1 parent d9407d8 commit 18c9c99
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/libfetch/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ fetch_pctdecode(char *dst, const char *src, size_t dlen)
}
if (dlen-- > 0)
*dst++ = c;
else
return (NULL);
}
return (s);
}
Expand Down Expand Up @@ -376,11 +378,15 @@ fetchParseURL(const char *URL)
if (p && *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;
Expand Down

0 comments on commit 18c9c99

Please sign in to comment.