summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/resolve/resolved-dns-domain.c3
-rw-r--r--src/resolve/resolved-dns-domain.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-domain.c b/src/resolve/resolved-dns-domain.c
index 27739c1e57..a41052dde3 100644
--- a/src/resolve/resolved-dns-domain.c
+++ b/src/resolve/resolved-dns-domain.c
@@ -203,6 +203,9 @@ int dns_name_normalize(const char *s, char **_ret) {
n += r;
}
+ if (n > DNS_NAME_MAX)
+ return -EINVAL;
+
if (!GREEDY_REALLOC(ret, allocated, n + 1))
return -ENOMEM;
diff --git a/src/resolve/resolved-dns-domain.h b/src/resolve/resolved-dns-domain.h
index d6b4bdd083..809c4daacc 100644
--- a/src/resolve/resolved-dns-domain.h
+++ b/src/resolve/resolved-dns-domain.h
@@ -25,6 +25,7 @@
#include "in-addr-util.h"
#define DNS_LABEL_MAX 63
+#define DNS_NAME_MAX 255
int dns_label_unescape(const char **name, char *dest, size_t sz);
int dns_label_escape(const char *p, size_t l, char **ret);