Skip to content

Commit

Permalink
dns_resolver: Do not accept domain names longer than 255 chars
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Manuel Schölling authored and David S. Miller committed Jun 5, 2014
1 parent 555878b commit 9638f67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/dns_resolver/dns_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 9638f67

Please sign in to comment.