提交 186412fe 编写于 作者: J Ján Tomko

virDomainDeviceAliasIsUserAlias: tolerate NULL

Do not crash in virDomainDeviceInfoParseXML if someone provides
an 'alias' element without a 'name' attribute.
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 5123e6ed
......@@ -5573,7 +5573,7 @@ virDomainDeviceDefValidateAliasesIterator(virDomainDefPtr def,
struct virDomainDefValidateAliasesData *data = opaque;
const char *alias = info->alias;
if (!alias || !virDomainDeviceAliasIsUserAlias(alias))
if (!virDomainDeviceAliasIsUserAlias(alias))
return 0;
/* Some crazy backcompat for consoles. */
......@@ -6702,7 +6702,7 @@ virDomainDeviceAddressParseXML(xmlNodePtr address,
bool
virDomainDeviceAliasIsUserAlias(const char *aliasStr)
{
return STRPREFIX(aliasStr, USER_ALIAS_PREFIX);
return aliasStr && STRPREFIX(aliasStr, USER_ALIAS_PREFIX);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册