summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-domain.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-07-16 03:29:20 +0200
committerLennart Poettering <lennart@poettering.net>2014-07-16 03:29:20 +0200
commit1fa65c593c6d2fbafe9d0f7caa6eb1c8034da2e0 (patch)
treed0f33b45eb84d3ce6f9d8a2d5e4062e1808982c0 /src/resolve/resolved-dns-domain.c
parent3fe1169fe3a692b8416848abc451bd1e4cbc4e4a (diff)
dns-domain: never allow labels that are larger than 63 chars
Diffstat (limited to 'src/resolve/resolved-dns-domain.c')
-rw-r--r--src/resolve/resolved-dns-domain.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-domain.c b/src/resolve/resolved-dns-domain.c
index 33ae2610e1..27739c1e57 100644
--- a/src/resolve/resolved-dns-domain.c
+++ b/src/resolve/resolved-dns-domain.c
@@ -45,6 +45,9 @@ int dns_label_unescape(const char **name, char *dest, size_t sz) {
if (sz <= 0)
return -ENOSPC;
+ if (r >= DNS_LABEL_MAX)
+ return -EINVAL;
+
if (*n == '\\') {
/* Escaped character */
@@ -114,6 +117,9 @@ int dns_label_escape(const char *p, size_t l, char **ret) {
assert(p);
assert(ret);
+ if (l > DNS_LABEL_MAX)
+ return -EINVAL;
+
s = malloc(l * 4 + 1);
if (!s)
return -ENOMEM;