[libvirt] review fallout: short memset
Daniel P. Berrange
berrange at redhat.com
Tue Dec 2 14:18:43 UTC 2008
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
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list