Date: Mon, 6 Mar 2017 13:15:21 -0500 From: Pedro Giffuni <pfg@FreeBSD.org> To: Baptiste Daroussin <bapt@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r314778 - head/lib/libfetch Message-ID: <9e86f0a7-c24b-2bda-e289-02bacb699c72@FreeBSD.org> In-Reply-To: <20170306154419.psguuxspco3hgw64@ivaldir.net> References: <201703061538.v26Fc33J022910@repo.freebsd.org> <20170306154419.psguuxspco3hgw64@ivaldir.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi; On 3/6/2017 10:44 AM, Baptiste Daroussin wrote: > On Mon, Mar 06, 2017 at 03:38:03PM +0000, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Mon Mar 6 15:38:03 2017 >> New Revision: 314778 >> URL: https://svnweb.freebsd.org/changeset/base/314778 >> >> Log: >> libfetch: extra bounds checking through reallocarray(3). >> >> Reviewed by: des >> MFC after: 1 week >> >> Modified: >> head/lib/libfetch/common.c >> >> Modified: head/lib/libfetch/common.c >> ============================================================================== >> --- head/lib/libfetch/common.c Mon Mar 6 15:37:34 2017 (r314777) >> +++ head/lib/libfetch/common.c Mon Mar 6 15:38:03 2017 (r314778) >> @@ -1306,7 +1306,7 @@ fetch_add_entry(struct url_ent **p, int >> } >> >> if (*len >= *size - 1) { >> - tmp = realloc(*p, (*size * 2 + 1) * sizeof(**p)); >> + tmp = reallocarray(*p, *size * 2 + 1, sizeof(**p)); > It reduces portability of libfetch (which pkg depends on) I can probably add an > implementation of reallocarry in pkg itself. This is an unavoidable consequence of adding functions to libc: we may find uses for them. Pedro.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9e86f0a7-c24b-2bda-e289-02bacb699c72>