summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Schölling <manuel.schoelling@gmx.de>2014-05-31 23:37:40 +0200
committerDavid S. Miller <davem@davemloft.net>2014-06-05 00:05:53 -0700
commit9638f6713ff556bdc34e9d18eeb7c1b25b35e5ce (patch)
tree15d915b3f585a6ad528bfa936a7d44bec9093ab2
parent555878b9ee83b08701100baa0fd79d3954a37ce7 (diff)
downloadop-kernel-dev-9638f6713ff556bdc34e9d18eeb7c1b25b35e5ce.zip
op-kernel-dev-9638f6713ff556bdc34e9d18eeb7c1b25b35e5ce.tar.gz
dns_resolver: Do not accept domain names longer than 255 chars
According to RFC1035 "[...] the total length of a domain name (i.e., label octets and label length octets) is restricted to 255 octets or less." Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/dns_resolver/dns_query.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c
index e7b6d53..5b49958 100644
--- a/net/dns_resolver/dns_query.c
+++ b/net/dns_resolver/dns_query.c
@@ -93,8 +93,8 @@ int dns_query(const char *type, const char *name, size_t namelen,
}
if (!namelen)
- namelen = strlen(name);
- if (namelen < 3)
+ namelen = strnlen(name, 256);
+ if (namelen < 3 || namelen > 255)
return -EINVAL;
desclen += namelen + 1;
OpenPOWER on IntegriCloud