svn commit: r282252 - head/lib/libcapsicum

Mariusz Zaborski oshogbo at FreeBSD.org
Wed Apr 29 23:08:44 UTC 2015


On 30 April 2015 at 01:00, Garrett Cooper <yaneurabeya at gmail.com> wrote:

> On Apr 29, 2015, at 15:19, Mariusz Zaborski <oshogbo at FreeBSD.org> wrote:
>
> > Author: oshogbo
> > Date: Wed Apr 29 22:19:40 2015
> > New Revision: 282252
> > URL: https://svnweb.freebsd.org/changeset/base/282252
> >
> > Log:
> >  Remove the use of nvlist_.*[vf] functions from libcapsicum and replace
> >  them with snprintf(3). Assert the results of snprintf(3).
> >
> >  Approved by: pjd (mentor)
>
>         assert(3) can be compiled out with NDEBUG, causing memory
> corruption on memory allocation failure or snprintf-related failure. Is
> using assert a good idea?
> Thanks!
> -NGie
>
In my opinion it's only sanitary check for developers.
We not assume that snprintf(3) will fail in those condition - buffer is far
bigger then max value stored there (name (4) + MAX_UINT (21) = 25, buffer
is declared 64).
But it could fail if some developer will change the name of the variable
and forgot to resize the array.
So like I say it's only sanitary check.

Thanks,
Mariusz Zaborski


More information about the svn-src-all mailing list