summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2016-09-09 17:11:54 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-09-09 16:11:54 +0100
commitf35c467db30481be231fca0056b132b2214f2d42 (patch)
tree925dcfcf13a05b5b0a889e70b79cd5d27883169e /src/shared
parent0dd99f86addd1f81e24e89807b6bc4aab57d5793 (diff)
shared: recognize DNS names with more than one trailing dot as invalid (#4111)
One trailing dot is valid, but more than one isn't. This also fixes glibc's posix/tst-getaddrinfo5 test. Fixes #3978.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/dns-domain.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
index 835557c6b2..892f0aadf5 100644
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
@@ -131,6 +131,10 @@ int dns_label_unescape(const char **name, char *dest, size_t sz) {
if (r == 0 && *n)
return -EINVAL;
+ /* More than one trailing dot? */
+ if (*n == '.')
+ return -EINVAL;
+
if (sz >= 1 && d)
*d = 0;