Commit 70d6998149 for qemu.org

commit 70d69981492ebc6c19a3f2b31ce87c4e9d057339
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date:   Mon Sep 7 14:50:04 2026 +0400

    qga/vss-win32: pass character count instead of byte count to volume APIs

    FindFirstVolumeW, FindNextVolumeW and GetVolumePathNamesForVolumeNameW
    expect a buffer length in characters, not bytes.

    Use ARRAYSIZE() to pass the correct character count.

    Fixes: b39297aedfab ("qemu-ga: Add Windows VSS provider and requester as DLL")
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
    Link: https://lore.kernel.org/qemu-devel/20260907-qga-v1-6-86456ad356e2@redhat.com
    Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>

diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index b9269acb5b..1fd73312ba 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -432,7 +432,7 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
     }

     if (!mountpoints) {
-        volume = FindFirstVolumeW(short_volume_name, sizeof(short_volume_name));
+        volume = FindFirstVolumeW(short_volume_name, ARRAYSIZE(short_volume_name));
         if (volume == INVALID_HANDLE_VALUE) {
             err_set(errset, hr, "failed to find first volume");
             goto out;
@@ -447,7 +447,7 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
                     WCHAR volume_path_name[MAX_PATH];
                     if (GetVolumePathNamesForVolumeNameW(
                             short_volume_name, volume_path_name,
-                            sizeof(volume_path_name), NULL) &&
+                            ARRAYSIZE(volume_path_name), NULL) &&
                             *volume_path_name) {
                         display_name = volume_path_name;
                     }
@@ -459,7 +459,7 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
                 num_fixed_drives++;
             }
             if (!FindNextVolumeW(volume, short_volume_name,
-                                 sizeof(short_volume_name))) {
+                                 ARRAYSIZE(short_volume_name))) {
                 FindVolumeClose(volume);
                 break;
             }