mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
Fix DMI uuid parsing.
valgrind was complaining that virUUIDParse was depending on an uninitialized value. Indeed it was; virSetHostUUIDStr() didn't initialize the dmiuuid buffer to 0's, meaning that anything after the string read from /sys was uninitialized. Clear out the dmiuuid buffer before use, and make sure to always leave a \0 at the end. Signed-off-by: Chris Lalancette <clalance@redhat.com>
This commit is contained in:
parent
e7da872294
commit
435fa6d709
@ -286,7 +286,8 @@ virSetHostUUIDStr(const char *uuid)
|
|||||||
return EEXIST;
|
return EEXIST;
|
||||||
|
|
||||||
if (!uuid) {
|
if (!uuid) {
|
||||||
if (!getDMISystemUUID(dmiuuid, sizeof(dmiuuid))) {
|
memset(dmiuuid, 0, sizeof(dmiuuid));
|
||||||
|
if (!getDMISystemUUID(dmiuuid, sizeof(dmiuuid) - 1)) {
|
||||||
if (!virUUIDParse(dmiuuid, host_uuid))
|
if (!virUUIDParse(dmiuuid, host_uuid))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user