From owner-svn-src-projects@FreeBSD.ORG Thu Oct 9 12:54:57 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 324CF7E4; Thu, 9 Oct 2014 12:54:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E8879F5; Thu, 9 Oct 2014 12:54:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99Csunn068066; Thu, 9 Oct 2014 12:54:56 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99Csuh1068065; Thu, 9 Oct 2014 12:54:56 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410091254.s99Csuh1068065@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 9 Oct 2014 12:54:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r272818 - projects/ipfw/sbin/ipfw X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 12:54:57 -0000 Author: melifaro Date: Thu Oct 9 12:54:56 2014 New Revision: 272818 URL: https://svnweb.freebsd.org/changeset/base/272818 Log: * Fix use-after-free in table printing code. * Fix showing human-readable error in table cmds code. Modified: projects/ipfw/sbin/ipfw/tables.c Modified: projects/ipfw/sbin/ipfw/tables.c ============================================================================== --- projects/ipfw/sbin/ipfw/tables.c Thu Oct 9 12:37:53 2014 (r272817) +++ projects/ipfw/sbin/ipfw/tables.c Thu Oct 9 12:54:56 2014 (r272818) @@ -1018,6 +1018,8 @@ table_modify_record(ipfw_obj_header *oh, if (error == 0) return; + /* Get real OS error */ + error = errno; /* Try to provide more human-readable error */ switch (error) { @@ -1551,12 +1553,11 @@ tables_foreach(table_cb_t *f, void *arg, olh->size = sz; if (do_get3(IP_FW_TABLES_XLIST, &olh->opheader, &sz) != 0) { + sz = olh->size; free(olh); - if (errno == ENOMEM) { - sz = olh->size; - continue; - } - return (errno); + if (errno != ENOMEM) + return (errno); + continue; } if (sort != 0)