1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00

Fix an incorrect pointer usage and pass the right pointer to freeifaddrs(),

which would cause a free() inside allocated chunk.

Without this change, the class could crash with jemalloc debugging options
enabled.  The patch have also been submitted to upstream maintainer.

Reported by:	lev
Submitted by:	delphij
PR:		ports/167938
Approved by:	perl@ (swills)
This commit is contained in:
Xin LI 2012-05-15 20:48:06 +00:00
parent f53ea122aa
commit 43a8fdff46
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=296694
2 changed files with 28 additions and 0 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= IO-Interface
PORTVERSION= 1.06
PORTREVISION= 1
CATEGORIES= net perl5
MASTER_SITES= CPAN
PKGNAMEPREFIX= p5-

View File

@ -0,0 +1,27 @@
--- ./Interface.xs.orig 2008-06-06 08:51:42.000000000 -0700
+++ ./Interface.xs 2012-05-15 13:16:22.856348098 -0700
@@ -567,6 +567,7 @@
struct ifreq ifr;
#if (defined(USE_GETIFADDRS) && defined(HAVE_SOCKADDR_DL_STRUCT))
struct ifaddrs* ifap = NULL;
+ struct ifaddrs* saved_ifap = NULL;
struct sockaddr_dl* sdl;
sa_family_t family;
char *sdlname, *haddr, *s;
@@ -581,6 +582,7 @@
#endif
#if (defined(USE_GETIFADDRS) && defined(HAVE_SOCKADDR_DL_STRUCT))
getifaddrs(&ifap);
+ saved_ifap = ifap;
while(1) {
if (ifap == NULL) break;
@@ -595,7 +597,7 @@
}
ifap = ifap -> ifa_next;
}
- freeifaddrs(ifap);
+ freeifaddrs(saved_ifap);
s = hwaddr;
s[0] = '\0';