summaryrefslogtreecommitdiff
path: root/src/shared/dns-domain.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-12-28 15:05:50 +0100
committerTom Gundersen <teg@jklm.no>2015-12-28 15:05:50 +0100
commit7fdfc8634e079559c9f8ca7f0bbbd660549d6118 (patch)
tree9dd72b708d610f3e78b597256cd3f194445f07b2 /src/shared/dns-domain.c
parentad798a641a775e795dc32916d57a3d16cebc8a7d (diff)
parent160fbda9079d8edb5f9c4f6c650f23d27578f469 (diff)
Merge pull request #2232 from poettering/dnssec8
Eigth DNSSEC patch set
Diffstat (limited to 'src/shared/dns-domain.c')
-rw-r--r--src/shared/dns-domain.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
index 0273b9e3c9..68404ca9e5 100644
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
@@ -98,8 +98,13 @@ int dns_label_unescape(const char **name, char *dest, size_t sz) {
((unsigned) (n[1] - '0') * 10) +
((unsigned) (n[2] - '0'));
- /* Don't allow CC characters or anything that doesn't fit in 8bit */
- if (k < ' ' || k > 255 || k == 127)
+ /* Don't allow anything that doesn't
+ * fit in 8bit. Note that we do allow
+ * control characters, as some servers
+ * (e.g. cloudflare) are happy to
+ * generate labels with them
+ * inside. */
+ if (k > 255)
return -EINVAL;
if (d)
@@ -245,7 +250,7 @@ int dns_label_escape(const char *p, size_t l, char *dest, size_t sz) {
*(q++) = *p;
sz -= 1;
- } else if ((uint8_t) *p >= (uint8_t) ' ' && *p != 127) {
+ } else {
/* Everything else */
@@ -259,8 +264,7 @@ int dns_label_escape(const char *p, size_t l, char *dest, size_t sz) {
sz -= 4;
- } else
- return -EINVAL;
+ }
p++;
l--;