[netcf-devel] [PATCH] eliminate use of uninitialized data when getting mac address

Eric Blake eblake at redhat.com
Wed Jan 8 14:08:00 UTC 2014


On 01/08/2014 04:04 AM, Laine Stump wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1046594
> 
> If the call to get_augeas() at the top of aug_get_mac() failed, we
> would goto error and FREE(path), which would not have been
> initialized. And if by some magic of fate we happened to get past
> that, we would return garbage for the return code, since r was also
> not initialized. This patch initializes both path and r to fix the
> crash documented in Bug 1046594.
> 
> Although it doesn't directly impact the referenced bug, a quick audit
> of other functions in the same file showed that defnode() had the same
> problem with uninitialized "r". Beyond that, I also defensively
> initialized the pointer to mac address to NULL both in aug_get_mac()
> as well as two of its callers, to make future audits of the code
> easier, and to shut up both valgrind and whatever static analyzers
> might be run on the code.
> ---
>  src/drv_redhat.c  | 4 ++--
>  src/drv_suse.c    | 4 ++--
>  src/dutil_linux.c | 9 +++++----
>  3 files changed, 9 insertions(+), 8 deletions(-)
> 

ACK

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <https://lists.fedorahosted.org/pipermail/netcf-devel/attachments/20140108/94d2b681/attachment.sig>


More information about the netcf-devel mailing list