mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virDomainDeviceAliasIsUserAlias: tolerate NULL
Do not crash in virDomainDeviceInfoParseXML if someone provides an 'alias' element without a 'name' attribute. Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
5123e6ed1f
commit
186412fe76
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user