]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Fix Length calculation in PdoQueryId
authorOwen Smith <owen.smith@cloud.com>
Wed, 13 Sep 2023 13:45:14 +0000 (14:45 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Thu, 28 Sep 2023 12:45:47 +0000 (13:45 +0100)
Decrease Length by the string length of the current ID before moving
the Buffer value to the end of the current ID. Without this, Length
is not decreased, leading to potential issues with the next call to
RtlStringCbPrintfW.
Note: the second chunk it to maintain consistent ordering of operations
for clarity, and has no functional change.

Signed-off-by: Owen Smith <owen.smith@cloud.com>
src/xenbus/pdo.c

index 5e6fff346956c2caf1795b7275e1c73bc9a9ad96..663dd3bb89618100586e076b701059c539d6b4fd 100644 (file)
@@ -1456,11 +1456,11 @@ PdoQueryId(
                                         Revision->Number);
             ASSERT(NT_SUCCESS(status));
 
-            Buffer += wcslen(Buffer);
             Length -= (ULONG)(wcslen(Buffer) * sizeof (WCHAR));
+            Buffer += wcslen(Buffer);
 
-            Buffer++;
             Length -= sizeof (WCHAR);
+            Buffer++;
 
             --Index;
         }