]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix possible crash in handling IO Error event
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 11 May 2010 14:34:38 +0000 (10:34 -0400)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 14 May 2010 13:18:51 +0000 (09:18 -0400)
If the IO error event does not include a reason, then there
is a possible crash dispatching the event

* src/conf/domain_event.c: Missing check for a NULL reason before
  strduping allows for a crash

src/conf/domain_event.c

index e5bd4583477b28b32755e47208bcef05092f7fa3..e88aafea8cb2a5377d18b35db46f2f0ef98c48f5 100644 (file)
@@ -671,7 +671,7 @@ static virDomainEventPtr virDomainEventIOErrorNewFromObjImpl(int event,
         ev->data.ioError.action = action;
         if (!(ev->data.ioError.srcPath = strdup(srcPath)) ||
             !(ev->data.ioError.devAlias = strdup(devAlias)) ||
-            !(ev->data.ioError.reason = strdup(reason))) {
+            (reason && !(ev->data.ioError.reason = strdup(reason)))) {
             virDomainEventFree(ev);
             ev = NULL;
         }