[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [libvirt] review fallout: short memset
- From: Daniel Veillard <veillard redhat com>
- To: "Daniel P. Berrange" <berrange redhat com>
- Cc: Libvirt <libvir-list redhat com>
- Subject: Re: [libvirt] review fallout: short memset
- Date: Tue, 2 Dec 2008 17:40:12 +0100
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 veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]