mirror of https://gitee.com/openkylin/linux.git
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:
parent
555878b9ee
commit
9638f6713f
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue