chiark / gitweb /
dns-domain: enforce maximum DNS domain name length
authorLennart Poettering <lennart@poettering.net>
Wed, 16 Jul 2014 23:10:47 +0000 (01:10 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 16 Jul 2014 23:41:52 +0000 (01:41 +0200)
src/resolve/resolved-dns-domain.c
src/resolve/resolved-dns-domain.h

index 27739c1..a41052d 100644 (file)
@@ -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;
 
index d6b4bdd..809c4da 100644 (file)
@@ -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);