[libvirt] [PATCH v2 3/4] remote: Add a check for zero sized client-side buffers

Erik Skultety posted 4 patches 5 years ago
[libvirt] [PATCH v2 3/4] remote: Add a check for zero sized client-side buffers
Posted by Erik Skultety 5 years ago
Adjustment to the dispatch code which is not generated by
gendispatch.pl.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
---
 src/remote/remote_daemon_dispatch.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index f369ffb02a..1d75ec3d37 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -2753,6 +2753,12 @@ remoteDispatchDomainGetVcpuPinInfo(virNetServerPtr server G_GNUC_UNUSED,
         goto cleanup;
     }
 
+    if (args->ncpumaps == 0) {
+        ret->cpumaps.cpumaps_len = 0;
+        rv = 0;
+        goto cleanup;
+    }
+
     if (INT_MULTIPLY_OVERFLOW(args->ncpumaps, args->maplen) ||
         args->ncpumaps * args->maplen > REMOTE_CPUMAPS_MAX) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX"));
-- 
2.23.0

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

Re: [libvirt] [PATCH v2 3/4] remote: Add a check for zero sized client-side buffers
Posted by Daniel P. Berrangé 5 years ago
On Thu, Nov 21, 2019 at 09:58:31AM +0100, Erik Skultety wrote:
> Adjustment to the dispatch code which is not generated by
> gendispatch.pl.
> 
> Signed-off-by: Erik Skultety <eskultet@redhat.com>
> ---
>  src/remote/remote_daemon_dispatch.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
> index f369ffb02a..1d75ec3d37 100644
> --- a/src/remote/remote_daemon_dispatch.c
> +++ b/src/remote/remote_daemon_dispatch.c
> @@ -2753,6 +2753,12 @@ remoteDispatchDomainGetVcpuPinInfo(virNetServerPtr server G_GNUC_UNUSED,
>          goto cleanup;
>      }
>  
> +    if (args->ncpumaps == 0) {
> +        ret->cpumaps.cpumaps_len = 0;
> +        rv = 0;
> +        goto cleanup;
> +    }

Same comment as previous patch, I don't think we should be short-circuiting
the drivers in our dispatch code. Patch 4 makes this redundant by fixing
the root cause bug.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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