public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Use "test.invalid." for invalid hostname
@ 2021-09-10 14:11 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-09-10 14:11 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 252 bytes --]

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.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1373 bytes --]

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.

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 );

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-10 14:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 14:11 [committed] libstdc++: Use "test.invalid." for invalid hostname Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).