[libvirt] [PATCH 2/2] Fix possible crash in handling IO Error event

Eric Blake eblake at redhat.com
Tue May 11 15:19:41 UTC 2010


On 05/11/2010 08:36 AM, Daniel P. Berrange wrote:
> 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 |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
> index e5bd458..e88aafe 100644
> --- a/src/conf/domain_event.c
> +++ b/src/conf/domain_event.c
> @@ -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)))) {

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100511/5ea8af00/attachment-0001.sig>


More information about the libvir-list mailing list