summaryrefslogtreecommitdiff
path: root/src/shared/dns-domain.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-29 14:12:05 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-30 19:37:41 +0100
commit3b37fa735224e58fcc23c737b764d13e22c2885b (patch)
tree45fc4141398824a587a28116506184e5e405bf15 /src/shared/dns-domain.h
parentbca27e1729b496081b0fa4e2754f5fcdcc0efce5 (diff)
dns-domain: be more strict when encoding/decoding labels
Labels of zero length are not OK, refuse them early on. The concept of a "zero-length label" doesn't exist, a zero-length full domain name however does (representing the root domain). See RFC 2181, Section 11.
Diffstat (limited to 'src/shared/dns-domain.h')
-rw-r--r--src/shared/dns-domain.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/shared/dns-domain.h b/src/shared/dns-domain.h
index 99c72574db..c68f1945e1 100644
--- a/src/shared/dns-domain.h
+++ b/src/shared/dns-domain.h
@@ -25,7 +25,10 @@
#include "hashmap.h"
#include "in-addr-util.h"
+/* Length of a single label, with all escaping removed, excluding any trailing dot or NUL byte */
#define DNS_LABEL_MAX 63
+
+/* Worst case length of a single label, with all escaping applied and room for a trailing NUL byte. */
#define DNS_LABEL_ESCAPED_MAX (DNS_LABEL_MAX*4+1)
int dns_label_unescape(const char **name, char *dest, size_t sz);