提交 9638f671 编写于 作者: M Manuel Schölling 提交者: David S. Miller

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: NManuel Schölling <manuel.schoelling@gmx.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 555878b9
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册