[committed] libstdc++: Use "test.invalid." for invalid hostname

Message ID YTtnk67OZPimLGrG@redhat.com
State New
Headers show
Series
  • [committed] libstdc++: Use "test.invalid." for invalid hostname
Related show

Commit Message

apinski--- via Gcc-patches Sept. 10, 2021, 2:11 p.m.
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.

Tested x86_64-linux. Committed to trunk.
commit 7f8af6dc82a0dac0d97fdd4d1f2055e932f29216
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Sep 10 15:08:27 2021

    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.

Patch

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 69be194fa29..8bd4dbacad2 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 );