Add a length sanity check - just in case there's an implementation out there
that parses AF_UNIX addresses in getaddrinfo() or something. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@189 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -639,7 +639,8 @@ int lame_resolv (const char *hostname, struct sockaddr_foobar *buffer)
|
||||
{
|
||||
#ifdef IPV6
|
||||
struct addrinfo *res;
|
||||
if (getaddrinfo(hostname, NULL, NULL, &res) || !res)
|
||||
if (getaddrinfo(hostname, NULL, NULL, &res) || !res ||
|
||||
res->ai_addrlen > sizeof *buffer)
|
||||
return -1;
|
||||
|
||||
memmove(buffer, res->ai_addr, res->ai_addrlen);
|
||||
|
||||
Reference in New Issue
Block a user