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(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/