Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Apr 2017 01:13:47 +0000 (UTC)
From:      Cy Schubert <cy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316993 - head/contrib/ipfilter/lib
Message-ID:  <201704160113.v3G1DlbA028401@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cy
Date: Sun Apr 16 01:13:47 2017
New Revision: 316993
URL: https://svnweb.freebsd.org/changeset/base/316993

Log:
  Fix CID 1372601, possible NULL pointer dereference should
  reallocarray() fail.
  
  Reported by:	Coverity CID 1372601
  MFC after:	1 week

Modified:
  head/contrib/ipfilter/lib/parsefields.c

Modified: head/contrib/ipfilter/lib/parsefields.c
==============================================================================
--- head/contrib/ipfilter/lib/parsefields.c	Sat Apr 15 23:35:57 2017	(r316992)
+++ head/contrib/ipfilter/lib/parsefields.c	Sun Apr 16 01:13:47 2017	(r316993)
@@ -32,6 +32,10 @@ wordtab_t *parsefields(table, arg)
 			fields = malloc(2 * sizeof(*fields));
 		} else {
 			fields = reallocarray(fields, num + 1, sizeof(*fields));
+			if (fields == NULL) {
+				perror("memory allocation error at __LINE__ in __FUNCTIOIN__ in __FILE__");
+				abort();
+			}
 		}
 
 		if (t == NULL) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704160113.v3G1DlbA028401>