From owner-freebsd-ports-bugs@FreeBSD.ORG Tue May 15 20:30:02 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8EC1F1065673 for ; Tue, 15 May 2012 20:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 604438FC14; Tue, 15 May 2012 20:30:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q4FKU2nS064654; Tue, 15 May 2012 20:30:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q4FKU2rA064653; Tue, 15 May 2012 20:30:02 GMT (envelope-from gnats) Resent-Date: Tue, 15 May 2012 20:30:02 GMT Resent-Message-Id: <201205152030.q4FKU2rA064653@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Cc: d@delphij.net Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Xin LI Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F60F106566B; Tue, 15 May 2012 20:23:43 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E590E8FC08; Tue, 15 May 2012 20:23:42 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q4FKNgf7064507; Tue, 15 May 2012 20:23:42 GMT (envelope-from delphij@freefall.freebsd.org) Received: (from delphij@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q4FKNglK064506; Tue, 15 May 2012 20:23:42 GMT (envelope-from delphij) Message-Id: <201205152023.q4FKNglK064506@freefall.freebsd.org> Date: Tue, 15 May 2012 20:23:42 GMT From: Xin LI To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 X-GNATS-Notify: d@delphij.net Cc: lev@FreeBSD.org Subject: ports/167938: [PATCH] net/p5-IO-Interface: fix incorrect pointer usage X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Xin LI List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 May 2012 20:30:02 -0000 >Number: 167938 >Category: ports >Synopsis: [PATCH] net/p5-IO-Interface: fix incorrect pointer usage >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue May 15 20:30:01 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Xin LI >Release: FreeBSD 9.0-STABLE i386 >Organization: iXsystems, Inc. >Environment: System: FreeBSD freefall.freebsd.org 9.0-STABLE FreeBSD 9.0-STABLE #6 r235139: Tue May 8 21:19:03 UTC 2012 simon@freefall.freebsd.org:/usr/obj/usr/src/sys/FREEFALL i386 >Description: The current p5-IO-Interface code does an incorrect pointer usage, basically: getifaddrs(&ifap); while (1) { (some handling) ifap = ifap -> ifa_next; <-- 1) } freeifaddrs(ifap); <-- The freeifaddrs() will be passed with a potentionally different pointer because of 1). >How-To-Repeat: Call the function on latest -CURRENT. >Fix: The proposed changeset saves the ifap pointer and call freeifaddrs() with the saved one to avoid this problem. --- p5-IO-Interface.diff begins here --- Index: Makefile =================================================================== RCS file: /home/ncvs/ports/net/p5-IO-Interface/Makefile,v retrieving revision 1.12 diff -u -p -r1.12 Makefile --- Makefile 25 Jul 2011 01:07:02 -0000 1.12 +++ Makefile 15 May 2012 20:18:03 -0000 @@ -7,6 +7,7 @@ PORTNAME= IO-Interface PORTVERSION= 1.06 +PORTREVISION= 1 CATEGORIES= net perl5 MASTER_SITES= CPAN PKGNAMEPREFIX= p5- Index: files/patch-Interface.xs =================================================================== RCS file: files/patch-Interface.xs diff -N files/patch-Interface.xs --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-Interface.xs 15 May 2012 20:17:51 -0000 @@ -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'; --- p5-IO-Interface.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: