From: Michal Privoznik <mprivozn@redhat.com> The virNodeAllocPages() API accepts three arguments (among others): 1) pageSizes - array of hugepage sizes, 2) pageCounts - array of hugepage counts, 3) npages - size of both arrays. The API then extends pool of hupages of size pageSizes[i] by pageCounts[i] amount. Therefore, both arrays must be of the same length. Well, when it comes to RPC both arrays are serialized individually and thus after deserialization it should be checked that both arrays are of the same length. Resolves: https://gitlab.com/libvirt/libvirt/-/work_items/955 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/remote/remote_daemon_dispatch.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c index 2f1861f5bb..9c80bfa560 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -6978,6 +6978,14 @@ remoteDispatchNodeAllocPages(virNetServer *server G_GNUC_UNUSED, if (!conn) goto cleanup; + if (args->pageSizes.pageSizes_len != args->pageCounts.pageCounts_len) { + virReportError(VIR_ERR_RPC, + _("Number of page sizes (%u) does not match the number of page counts %u)"), + args->pageSizes.pageSizes_len, + args->pageCounts.pageCounts_len); + goto cleanup; + } + if ((len = virNodeAllocPages(conn, args->pageSizes.pageSizes_len, args->pageSizes.pageSizes_val, -- 2.56.1