From bce3aa73afedb732676202ea1f517be76d700a49 Mon Sep 17 00:00:00 2001 From: Peter Pentchev Date: Thu, 30 Dec 2004 14:22:10 +0000 Subject: [PATCH] Fix a getnameinfo() out-of-memory error caused by passing a 20-character buffer to hold a numeric IPv4/v6 address. Of course, IPv6 addresses may be a bit longer than 20 characters :) A-ha! moment during: discussion with the stunnel author --- security/stunnel/Makefile | 1 + security/stunnel/files/patch-src::network.c | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/security/stunnel/Makefile b/security/stunnel/Makefile index c11091df467b..26c91fff863f 100644 --- a/security/stunnel/Makefile +++ b/security/stunnel/Makefile @@ -7,6 +7,7 @@ PORTNAME= stunnel PORTVERSION= 4.06 +PORTREVISION= 1 CATEGORIES= security MASTER_SITES= http://www.stunnel.org/download/stunnel/src/ \ ftp://stunnel.mirt.net/stunnel/OBSOLETE/ \ diff --git a/security/stunnel/files/patch-src::network.c b/security/stunnel/files/patch-src::network.c index 799222470d3d..c95c293ad6a2 100644 --- a/security/stunnel/files/patch-src::network.c +++ b/security/stunnel/files/patch-src::network.c @@ -1,5 +1,5 @@ --- src/network.c.orig Thu Oct 14 18:03:49 2004 -+++ src/network.c Wed Dec 29 14:16:06 2004 ++++ src/network.c Thu Dec 30 16:12:16 2004 @@ -125,7 +125,7 @@ int retval; @@ -22,17 +22,19 @@ case EAI_FAMILY: return "ai_family not supported (EAI_FAMILY)"; case EAI_SOCKTYPE: -@@ -562,10 +566,13 @@ +@@ -561,11 +565,14 @@ + /* getnameinfo() version */ char *s_ntop(char *text, SOCKADDR_UNION *addr) { - char host[20], port[6]; +- char host[20], port[6]; ++ char host[IPLEN], port[6]; + int err; - if(getnameinfo(&addr->sa, addr_len(*addr), - host, 20, port, 6, NI_NUMERICHOST|NI_NUMERICSERV)) { - sockerror("getnameinfo"); + err = getnameinfo(&addr->sa, addr_len(*addr), -+ host, 20, port, 6, NI_NUMERICHOST|NI_NUMERICSERV); ++ host, IPLEN, port, 6, NI_NUMERICHOST|NI_NUMERICSERV); + if (err) { + s_log(LOG_ERR, "Error resolving the specified address: %s", + s_gai_strerror(err));