This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.26.9000-746-g9e0ad30


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  9e0ad3049dbae88d615bfb038e53bf365a39a634 (commit)
      from  e2a9fca8101443076235a8dbcfceaa2d96bf4801 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9e0ad3049dbae88d615bfb038e53bf365a39a634

commit 9e0ad3049dbae88d615bfb038e53bf365a39a634
Author: Florian Weimer <fweimer@redhat.com>
Date:   Sat Nov 11 11:41:45 2017 +0100

    resolv: ns_name_pton should report trailing \ as error [BZ #22413]

diff --git a/ChangeLog b/ChangeLog
index 5ddb6fd..4739e62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2017-11-11  Florian Weimer  <fweimer@redhat.com>
 
+	[BZ #22413]
+	* resolv/ns_name.c (ns_name_pton): Treat trailing backslash as error.
+	* resolv/tst-ns_name_pton.c (tests): Add trailing backslash tests.
+
+2017-11-11  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/tst-ns_name_pton.c: New file.
 	* resolv/Makefile (tests): Add tst-ns_name_pton.
 	(tst-ns_name_pton): Link against libresolv.
diff --git a/resolv/ns_name.c b/resolv/ns_name.c
index 08a75e2..73213fe 100644
--- a/resolv/ns_name.c
+++ b/resolv/ns_name.c
@@ -222,6 +222,11 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz)
 		}
 		*bp++ = (u_char)c;
 	}
+	if (escaped) {
+		/* Trailing backslash.  */
+		__set_errno (EMSGSIZE);
+		return -1;
+	}
 	c = (bp - label - 1);
 	if ((c & NS_CMPRSFLGS) != 0) {		/*%< Label too big. */
 		__set_errno (EMSGSIZE);
diff --git a/resolv/tst-ns_name_pton.c b/resolv/tst-ns_name_pton.c
index 879d97c..73bdb05 100644
--- a/resolv/tst-ns_name_pton.c
+++ b/resolv/tst-ns_name_pton.c
@@ -127,6 +127,13 @@ static const struct test_case tests[] =
       "\377\377", NULL, },
     { STRING63OCT "." STRING63OCT "." STRING63OCT "." STRING60OCT
       "\377\377\377", NULL, },
+    { "\\", NULL, },
+    { "\\\\", "\\\\", false },
+    { "\\\\.", "\\\\", true },
+    { "\\\\\\", NULL, },
+    { "a\\", NULL, },
+    { "a.\\", NULL, },
+    { "a.b\\", NULL, },
   };
 
 static int

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                 |    6 ++++++
 resolv/ns_name.c          |    5 +++++
 resolv/tst-ns_name_pton.c |    7 +++++++
 3 files changed, 18 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]