getnameinfo: check size and family of salen

pull/18/head
rofl0r 2012-12-17 23:21:58 +01:00
parent 346474a43b
commit 1c265b9628
1 changed files with 2 additions and 0 deletions

View File

@ -395,6 +395,8 @@ int pc_getnameinfo(const struct sockaddr *sa, socklen_t salen,
if(!proxychains_resolver) {
ret = true_getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
} else {
if(salen < sizeof(struct sockaddr_in) || SOCKFAMILY(*sa) != AF_INET)
return EAI_FAMILY;
if(hostlen) {
pc_stringfromipv4((unsigned char*) &(SOCKADDR_2(*sa)), ip_buf);
if(snprintf(host, hostlen, "%s", ip_buf) >= hostlen)