From ab7d59f1f63e24dd0ff74a8c28a1f7cab685b4b1 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Tue, 15 May 2012 14:01:42 +0000 Subject: [PATCH] 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 --- source/network.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/network.c b/source/network.c index d2666b3..2ffaa59 100644 --- a/source/network.c +++ b/source/network.c @@ -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);