chiark / gitweb /
dns-domain: enforce maximum DNS domain name length
[elogind.git] / src / resolve / resolved-dns-domain.c
index 27739c1..a41052d 100644 (file)
@@ -203,6 +203,9 @@ int dns_name_normalize(const char *s, char **_ret) {
                 n += r;
         }
 
                 n += r;
         }
 
+        if (n > DNS_NAME_MAX)
+                return -EINVAL;
+
         if (!GREEDY_REALLOC(ret, allocated, n + 1))
                 return -ENOMEM;
 
         if (!GREEDY_REALLOC(ret, allocated, n + 1))
                 return -ENOMEM;