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>
This commit is contained in:
Manuel Schölling 2014-05-31 23:37:40 +02:00 committed by David S. Miller
parent 555878b9ee
commit 9638f6713f
1 changed files with 2 additions and 2 deletions

View File

@ -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;