mirror of
https://github.com/rofl0r/proxychains-ng
synced 2025-01-08 22:22:52 +08:00
getnameinfo: check size and family of salen
This commit is contained in:
parent
346474a43b
commit
1c265b9628
@ -395,6 +395,8 @@ int pc_getnameinfo(const struct sockaddr *sa, socklen_t salen,
|
|||||||
if(!proxychains_resolver) {
|
if(!proxychains_resolver) {
|
||||||
ret = true_getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
|
ret = true_getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
|
||||||
} else {
|
} else {
|
||||||
|
if(salen < sizeof(struct sockaddr_in) || SOCKFAMILY(*sa) != AF_INET)
|
||||||
|
return EAI_FAMILY;
|
||||||
if(hostlen) {
|
if(hostlen) {
|
||||||
pc_stringfromipv4((unsigned char*) &(SOCKADDR_2(*sa)), ip_buf);
|
pc_stringfromipv4((unsigned char*) &(SOCKADDR_2(*sa)), ip_buf);
|
||||||
if(snprintf(host, hostlen, "%s", ip_buf) >= hostlen)
|
if(snprintf(host, hostlen, "%s", ip_buf) >= hostlen)
|
||||||
|
Loading…
Reference in New Issue
Block a user