1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-15 07:56:36 +00:00

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
This commit is contained in:
Peter Pentchev 2004-12-30 14:22:10 +00:00
parent be54244b47
commit bce3aa73af
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=125529
2 changed files with 7 additions and 4 deletions

View File

@ -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/ \

View File

@ -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));