[pacman-dev] [PATCH] package.c, fix incorrect buffersize

Pierre Neidhardt ambrevar at gmail.com
Sun Nov 1 09:39:36 UTC 2015


On 15-11-01 10:05:30, Rikard Falkeborn wrote:
> Den 1 nov 2015 09:55 skrev "Rikard Falkeborn" <rikard.falkeborn at gmail.com>:
> >
> >
> > Den 1 nov 2015 09:36 skrev "Pierre Neidhardt" <ambrevar at gmail.com>:
> > >
> > > There is a much simpler fix:
> > >
> > > > -     static const wchar_t *title_suffix = L" :";
> > > > -     static const wchar_t title_suffix[] = L" :";
> > >
> > > I'll commit the patch right row.
> > >
> > > --
> > > Pierre Neidhardt
> > >
> > > To communicate is the beginning of understanding.
> > >                 -- AT&T
> >
> > That's simpler. :)
> >
> > Can you check if clang is happy with the fix? The reason I found it in
> the first place was a clang warning. I don't have a computer nearby to test
> it on myself at the moment.
> >
> > /Rikard
> 
> Simpler but not correct I think. We don't want the size in bytes, we want
> the number of elements. So making it an array and using ARRAYSIZE would do
> the trick. Provided clang doesn't warn...  :)

Indeed. Replace the 'sizeof' right after with ARRAYSIZE.
Good catch!

-- 
Pierre Neidhardt


More information about the pacman-dev mailing list