提交 435fa6d7 编写于 作者: C Chris Lalancette

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: NChris Lalancette <clalance@redhat.com>
上级 e7da8722
......@@ -286,7 +286,8 @@ virSetHostUUIDStr(const char *uuid)
return EEXIST;
if (!uuid) {
if (!getDMISystemUUID(dmiuuid, sizeof(dmiuuid))) {
memset(dmiuuid, 0, sizeof(dmiuuid));
if (!getDMISystemUUID(dmiuuid, sizeof(dmiuuid) - 1)) {
if (!virUUIDParse(dmiuuid, host_uuid))
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册