mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-15 22:49:16 +00:00
lwip_getaddrinfo: check max name length
This commit is contained in:
parent
6795590603
commit
1fbbf0e837
@ -349,6 +349,10 @@ lwip_getaddrinfo(const char *nodename, const char *servname,
|
|||||||
total_size = sizeof(struct addrinfo) + sizeof(struct sockaddr_in);
|
total_size = sizeof(struct addrinfo) + sizeof(struct sockaddr_in);
|
||||||
if (nodename != NULL) {
|
if (nodename != NULL) {
|
||||||
namelen = strlen(nodename);
|
namelen = strlen(nodename);
|
||||||
|
if (namelen > DNS_MAX_NAME_LENGTH) {
|
||||||
|
/* invalid name length */
|
||||||
|
return EAI_FAIL;
|
||||||
|
}
|
||||||
LWIP_ASSERT("namelen is too long", (namelen + 1) <= (mem_size_t)-1);
|
LWIP_ASSERT("namelen is too long", (namelen + 1) <= (mem_size_t)-1);
|
||||||
total_size += namelen + 1;
|
total_size += namelen + 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user