X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=net.c;h=caf84c90f0680538140bc77b840befb2ec8cd9c8;hb=de24aa05c1376811be9f7f3c9a3f8c1fea14f13e;hp=4a31f013446877e45c780e7eb24a27a0a1042c3a;hpb=41bf9b01ed2193a5fe368e40b8b1f16b5c4b5495;p=paraslash.git diff --git a/net.c b/net.c index 4a31f013..caf84c90 100644 --- a/net.c +++ b/net.c @@ -142,9 +142,9 @@ static bool host_string_ok(const char *host) * \param hostlen The maximum length of \a host. * \param port To return the port number (if any) of \a url. * - * \return Pointer to \a host, or NULL if failed. - * If NULL is returned, \a host and \a portnum are undefined. If no - * port number was present in \a url, \a portnum is set to -1. + * \return Pointer to \a host, or \p NULL if failed. If \p NULL is returned, + * \a host and \a port are undefined. If no port number was present in \a url, + * \a port is set to -1. * * \sa RFC 3986, 3.2.2/3.2.3 */ @@ -168,16 +168,16 @@ char *parse_url(const char *url, if (*o++ != ']' || (*o != '\0' && *o != ':')) goto failed; } else { - for (; (*c = *o == ':'? '\0' : *o); c++, o++) - if (c == end) + for (; (*c = *o == ':'? '\0' : *o); c++, o++) { + if (c == end && o[1]) goto failed; + } } if (*o == ':') if (para_atoi32(++o, port) < 0 || *port < 0 || *port > 0xffff) goto failed; - if (host_string_ok(host)) return host; failed: