Re: [libvirt] [PATCH] qemu: avoid null dereference on failed migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 26, 2010 at 10:17:53AM -0700, Eric Blake wrote:
> From: Eric Blake <eblake@xxxxxxxxxx>
> 
> * src/qemu/qemu_monitor_text.c
> (qemuMonitorTextGetMigrationStatus): Check for failed strchr, to
> silence a coverity warning.
> 
> Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
> ---
>  src/qemu/qemu_monitor_text.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
> index 62ffcc6..e7b4b1f 100644
> --- a/src/qemu/qemu_monitor_text.c
> +++ b/src/qemu/qemu_monitor_text.c
> @@ -989,6 +989,11 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
>      if ((tmp = strstr(reply, MIGRATION_PREFIX)) != NULL) {
>          tmp += strlen(MIGRATION_PREFIX);
>          end = strchr(tmp, '\r');
> +        if (end == NULL) {
> +            qemuReportError(VIR_ERR_INTERNAL_ERROR,
> +                            _("unexpected migration status in %s"), reply);
> +            goto cleanup;
> +        }
>          *end = '\0';
> 
>          if ((*status = qemuMonitorMigrationStatusTypeFromString(tmp)) < 0) {
> -- 

ACK


Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]