Blame SOURCES/glibc-rh1039304-3.patch
|
|
978e96 |
commit 9e0ad3049dbae88d615bfb038e53bf365a39a634
|
|
|
978e96 |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
978e96 |
Date: Sat Nov 11 11:41:45 2017 +0100
|
|
|
978e96 |
|
|
|
978e96 |
resolv: ns_name_pton should report trailing \ as error [BZ #22413]
|
|
|
978e96 |
|
|
|
978e96 |
diff --git a/resolv/ns_name.c b/resolv/ns_name.c
|
|
|
978e96 |
index 08a75e2fe0b4edd6..73213fee2dca530b 100644
|
|
|
978e96 |
--- a/resolv/ns_name.c
|
|
|
978e96 |
+++ b/resolv/ns_name.c
|
|
|
978e96 |
@@ -222,6 +222,11 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz)
|
|
|
978e96 |
}
|
|
|
978e96 |
*bp++ = (u_char)c;
|
|
|
978e96 |
}
|
|
|
978e96 |
+ if (escaped) {
|
|
|
978e96 |
+ /* Trailing backslash. */
|
|
|
978e96 |
+ __set_errno (EMSGSIZE);
|
|
|
978e96 |
+ return -1;
|
|
|
978e96 |
+ }
|
|
|
978e96 |
c = (bp - label - 1);
|
|
|
978e96 |
if ((c & NS_CMPRSFLGS) != 0) { /*%< Label too big. */
|
|
|
978e96 |
__set_errno (EMSGSIZE);
|
|
|
978e96 |
diff --git a/resolv/tst-ns_name_pton.c b/resolv/tst-ns_name_pton.c
|
|
|
978e96 |
index 879d97c9d3816210..73bdb05e08e405dc 100644
|
|
|
978e96 |
--- a/resolv/tst-ns_name_pton.c
|
|
|
978e96 |
+++ b/resolv/tst-ns_name_pton.c
|
|
|
978e96 |
@@ -127,6 +127,13 @@ static const struct test_case tests[] =
|
|
|
978e96 |
"\377\377", NULL, },
|
|
|
978e96 |
{ STRING63OCT "." STRING63OCT "." STRING63OCT "." STRING60OCT
|
|
|
978e96 |
"\377\377\377", NULL, },
|
|
|
978e96 |
+ { "\\", NULL, },
|
|
|
978e96 |
+ { "\\\\", "\\\\", false },
|
|
|
978e96 |
+ { "\\\\.", "\\\\", true },
|
|
|
978e96 |
+ { "\\\\\\", NULL, },
|
|
|
978e96 |
+ { "a\\", NULL, },
|
|
|
978e96 |
+ { "a.\\", NULL, },
|
|
|
978e96 |
+ { "a.b\\", NULL, },
|
|
|
978e96 |
};
|
|
|
978e96 |
|
|
|
978e96 |
static int
|