diff --git a/lib/libfetch/fetch.c b/lib/libfetch/fetch.c index b3ed702b3185..9eec0730fa7d 100644 --- a/lib/libfetch/fetch.c +++ b/lib/libfetch/fetch.c @@ -332,6 +332,8 @@ fetch_pctdecode(char *dst, const char *src, size_t dlen) } if (dlen-- > 0) *dst++ = c; + else + return (NULL); } return (s); } @@ -381,11 +383,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;