Date: Sat, 15 Apr 2017 20:34:32 -0700 From: Cy Schubert <Cy.Schubert@komquats.com> To: cem@freebsd.org Cc: Cy Schubert <cy@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r316993 - head/contrib/ipfilter/lib Message-ID: <201704160334.v3G3YWKc032550@slippy.cwsent.com> In-Reply-To: Message from Conrad Meyer <cem@freebsd.org> of "Sat, 15 Apr 2017 18:49:58 -0700." <CAG6CVpV562ezFLAF%2BJn4Qh2Eh4cj00=U3huuyXGys8=HK8DWgw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <CAG6CVpV562ezFLAF+Jn4Qh2Eh4cj00=U3huuyXGys8=HK8DWgw@mail.gmail.c om> , Conrad Meyer writes: > On Sat, Apr 15, 2017 at 6:13 PM, Cy Schubert <cy@freebsd.org> wrote: > > 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(*fiel > ds)); > > + if (fields == NULL) { > > + perror("memory allocation error at __LINE__ > in __FUNCTIOIN__ in __FILE__"); > > Hey Cy, > > Does this actually work? I was under the impression it wouldn't work. > Instead, maybe warnx("... error at %d in %s in %s", __LINE__, > __func__, __FILE__)? You are indeed correct Conrad. My mistake. I'll fix it right away. Thanks for pointing this out. -- Cheers, Cy Schubert <Cy.Schubert@cschubert.com> FreeBSD UNIX: <cy@FreeBSD.org> Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704160334.v3G3YWKc032550>