On 03/25/2018 09:28 PM, Ján Tomko wrote:
Do not crash in virDomainDeviceInfoParseXML if someone provides
an 'alias' element without a 'name' attribute.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/conf/domain_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 43725155c..d289ca2d0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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);
}
ACK with this squashed in:
diff --git i/src/conf/domain_conf.c w/src/conf/domain_conf.c
index d289ca2d08..ae7c0d9b71 100644
--- i/src/conf/domain_conf.c
+++ w/src/conf/domain_conf.c
@@ -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. */
Michal