From: Jonathan Wakely Date: Fri, 10 Sep 2021 14:08:27 +0000 (+0100) Subject: libstdc++: Use "test.invalid." for invalid hostname X-Git-Tag: upstream/12.2.0~5249 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f8af6dc82a0dac0d97fdd4d1f2055e932f29216;p=platform%2Fupstream%2Fgcc.git libstdc++: Use "test.invalid." for invalid hostname This avoids test.invalid.some.domain being successfully resolved. libstdc++-v3/ChangeLog: * testsuite/experimental/net/internet/resolver/ops/lookup.cc: Fix invalid hostname to only match the .invalid TLD. --- diff --git a/libstdc++-v3/testsuite/experimental/net/internet/resolver/ops/lookup.cc b/libstdc++-v3/testsuite/experimental/net/internet/resolver/ops/lookup.cc index 69be194..8bd4dba 100644 --- a/libstdc++-v3/testsuite/experimental/net/internet/resolver/ops/lookup.cc +++ b/libstdc++-v3/testsuite/experimental/net/internet/resolver/ops/lookup.cc @@ -97,7 +97,7 @@ test03() std::error_code ec; io_context ctx; ip::tcp::resolver resolv(ctx); - auto addrs = resolv.resolve("test.invalid", "http", ec); + auto addrs = resolv.resolve("test.invalid.", "http", ec); VERIFY( ec ); VERIFY( addrs.size() == 0 ); VERIFY( addrs.begin() == addrs.end() ); @@ -105,7 +105,7 @@ test03() #if __cpp_exceptions bool caught = false; try { - resolv.resolve("test.invalid", "http"); + resolv.resolve("test.invalid.", "http"); } catch (const std::system_error& e) { caught = true; VERIFY( e.code() == ec );