mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2024-12-22 04:08:47 +00:00
getnameinfo: return error if buffers are too small
This commit is contained in:
parent
ce655fdac8
commit
346474a43b
@ -397,10 +397,13 @@ int pc_getnameinfo(const struct sockaddr *sa, socklen_t salen,
|
|||||||
} else {
|
} else {
|
||||||
if(hostlen) {
|
if(hostlen) {
|
||||||
pc_stringfromipv4((unsigned char*) &(SOCKADDR_2(*sa)), ip_buf);
|
pc_stringfromipv4((unsigned char*) &(SOCKADDR_2(*sa)), ip_buf);
|
||||||
strncpy(host, ip_buf, hostlen);
|
if(snprintf(host, hostlen, "%s", ip_buf) >= hostlen)
|
||||||
|
return EAI_OVERFLOW;
|
||||||
|
}
|
||||||
|
if(servlen) {
|
||||||
|
if(snprintf(serv, servlen, "%d", ntohs(SOCKPORT(*sa))) >= servlen)
|
||||||
|
return EAI_OVERFLOW;
|
||||||
}
|
}
|
||||||
if(servlen)
|
|
||||||
snprintf(serv, servlen, "%d", ntohs(SOCKPORT(*sa)));
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user