]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Prevent crash of libvirtd without channel target name
authorAlex Jia <ajia@redhat.com>
Fri, 30 Mar 2012 09:10:31 +0000 (17:10 +0800)
committerAlex Jia <ajia@redhat.com>
Fri, 30 Mar 2012 10:10:56 +0000 (18:10 +0800)
* src/conf/domain_conf.c (virDomainChannelDefCheckABIStability): avoid
  crashing libvirtd due to derefing a NULL pointer.

For details, please see bug:
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=808371

Signed-off-by: Alex Jia <ajia@redhat.com>
src/conf/domain_conf.c

index 24e10e6ecc0bbca11645b731719f8dd0a16e26e9..4caef6f75b62ac6269937a7b2cd0bfb19fb42505 100644 (file)
@@ -9597,10 +9597,10 @@ static bool virDomainChannelDefCheckABIStability(virDomainChrDefPtr src,
 
     switch (src->targetType) {
     case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
-        if (STRNEQ(src->target.name, dst->target.name)) {
+        if (STRNEQ_NULLABLE(src->target.name, dst->target.name)) {
             virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("Target channel name %s does not match source %s"),
-                                 dst->target.name, src->target.name);
+                                 NULLSTR(dst->target.name), NULLSTR(src->target.name));
             goto cleanup;
         }
         break;