diff options
Diffstat (limited to 'libfetch/fetch.c')
-rw-r--r-- | libfetch/fetch.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libfetch/fetch.c b/libfetch/fetch.c index a0d4dbd..45c92aa 100644 --- a/libfetch/fetch.c +++ b/libfetch/fetch.c @@ -473,15 +473,12 @@ find_user: /* port */ if (*p == ':') { - for (q = ++p; *q && (*q != '/'); q++) - if (isdigit((unsigned char)*q)) - u->port = u->port * 10 + (*q - '0'); - else { - /* invalid port */ - url_seterr(URL_BAD_PORT); - goto ouch; - } - p = q; + u->port = fetch_parseuint(p + 1, &p, 10, IPPORT_MAX); + if (*p && *p != '/') { + /* invalid port */ + url_seterr(URL_BAD_PORT); + goto ouch; + } } /* document */ |