diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-03-08 09:59:35 +0100 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-03-31 19:53:05 +0200 |
commit | 231837911980ff55a661e2509642442435082c90 (patch) | |
tree | 956c67a43f57b157c1b17ef9ca0a07d03a5e484d | |
parent | f7c4d8622840b92a9f6cdb00d937d063a4efae9c (diff) | |
download | openssl-new-231837911980ff55a661e2509642442435082c90.tar.gz |
OSSL_parse_url(): Improve handling of IPv6 addresses
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14630)
-rw-r--r-- | crypto/http/http_lib.c | 5 | ||||
-rw-r--r-- | test/http_test.c | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/crypto/http/http_lib.c b/crypto/http/http_lib.c index 3bf642a4f4..f0fc770f22 100644 --- a/crypto/http/http_lib.c +++ b/crypto/http/http_lib.c @@ -87,11 +87,10 @@ int OSSL_parse_url(const char *url, char **pscheme, char **puser, char **phost, /* parse host name/address as far as needed here */ if (host[0] == '[') { /* ipv6 literal, which may include ':' */ - host++; - host_end = strchr(host, ']'); + host_end = strchr(host + 1, ']'); if (host_end == NULL) goto parse_err; - p = host_end + 1; + p = ++host_end; } else { /* look for start of optional port, path, query, or fragment */ host_end = strchr(host, ':'); diff --git a/test/http_test.c b/test/http_test.c index e59ef63833..0a3389c15f 100644 --- a/test/http_test.c +++ b/test/http_test.c @@ -204,7 +204,7 @@ static int test_http_url_ipv4(void) static int test_http_url_ipv6(void) { - return test_http_url_ok("http://[FF01::101]:6", 0, "FF01::101", "6", "/"); + return test_http_url_ok("http://[FF01::101]:6", 0, "[FF01::101]", "6", "/"); } static int test_http_url_invalid(const char *url) |