Re: [libvirt] review fallout: short memset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 02, 2008 at 02:18:43PM +0000, Daniel P. Berrange wrote:
> On Tue, Dec 02, 2008 at 03:02:53PM +0100, Jim Meyering wrote:
> > While reviewing unrelated changes, I spotted a short memset:
> > 
> >     char **names;
> >     ...
> >     memset(names, 0, maxnames);
> > 
> > That zeros out 1/4 or 1/8 of the memory than it should.
> > It should be doing this:
> > 
> >     memset(names, 0, maxnames * sizeof (*names));
> > 
> > I checked all memset uses and found a total of 6 uses like that.
> > This fixes them:
> 
> ACK to this immediate fix. As per my other mail we should consider
> adding a VIR_ZERO() macro for this, to avoid such errors recurring

  +1 to the fix and VIR_ZERO()

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]