From owner-svn-src-all@freebsd.org Sun Apr 23 03:16:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69404D40DD2; Sun, 23 Apr 2017 03:16:40 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 211953F1; Sun, 23 Apr 2017 03:16:40 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N3GdFa039925; Sun, 23 Apr 2017 03:16:39 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N3Gdi2039923; Sun, 23 Apr 2017 03:16:39 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201704230316.v3N3Gdi2039923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 23 Apr 2017 03:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317314 - in stable: 10/contrib/ipfilter/lib 10/contrib/ipfilter/tools 11/contrib/ipfilter/lib 11/contrib/ipfilter/tools X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 03:16:40 -0000 Author: cy Date: Sun Apr 23 03:16:38 2017 New Revision: 317314 URL: https://svnweb.freebsd.org/changeset/base/317314 Log: MFC r316993, r316994, r316997 as follows: r316993: Fix CID 1372601 in ipfilter/lib/parsefields.c, possible NULL pointer dereference should reallocarray() fail. Reported by: Coverity CID 1372601 r316994: Fix CID 1372600 in ipfilter/tools/ipf_y.y, possible NULL pointer dereference should reallocarray() fail. Reported by: Coverity CID 1372600 r316997: Use warnx() to issue error message. Reported by: cem Modified: stable/11/contrib/ipfilter/lib/parsefields.c stable/11/contrib/ipfilter/tools/ipf_y.y Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/ipfilter/lib/parsefields.c stable/10/contrib/ipfilter/tools/ipf_y.y Directory Properties: stable/10/ (props changed) Modified: stable/11/contrib/ipfilter/lib/parsefields.c ============================================================================== --- stable/11/contrib/ipfilter/lib/parsefields.c Sun Apr 23 02:30:06 2017 (r317313) +++ stable/11/contrib/ipfilter/lib/parsefields.c Sun Apr 23 03:16:38 2017 (r317314) @@ -1,4 +1,5 @@ #include "ipf.h" +#include extern int nohdrfields; @@ -32,6 +33,10 @@ wordtab_t *parsefields(table, arg) fields = malloc(2 * sizeof(*fields)); } else { fields = realloc(fields, (num + 1) * sizeof(*fields)); + if (fields == NULL) { + warnx("memory allocation error at %d in %s in %s", __LINE__, __FUNCTION__, __FILE__); + abort(); + } } if (t == NULL) { Modified: stable/11/contrib/ipfilter/tools/ipf_y.y ============================================================================== --- stable/11/contrib/ipfilter/tools/ipf_y.y Sun Apr 23 02:30:06 2017 (r317313) +++ stable/11/contrib/ipfilter/tools/ipf_y.y Sun Apr 23 03:16:38 2017 (r317314) @@ -9,6 +9,7 @@ #include "ipf.h" #include #include +#include #ifdef IPFILTER_BPF # include #endif @@ -2195,6 +2196,10 @@ char *phrase; for (i = 0, s = strtok(phrase, " \r\n\t"); s != NULL; s = strtok(NULL, " \r\n\t"), i++) { fb = realloc(fb, (i / 4 + 1) * sizeof(*fb)); + if (fb == NULL) { + warnx("memory allocation error at %d in %s in %s", __LINE__, __FUNCTION__, __FILE__); + abort(); + } l = (u_32_t)strtol(s, NULL, 0); switch (i & 3) {