]> xenbits.xensource.com Git - pvdrivers/win/xenvif.git/commitdiff
Fix Length calculation in PdoQueryId
authorOwen Smith <owen.smith@cloud.com>
Wed, 13 Sep 2023 14:15:20 +0000 (15:15 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Fri, 29 Sep 2023 13:40:39 +0000 (14:40 +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: second chunk it to maintain consistent ordering of operations,
  and is not a functional change

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

index 1d163c97b28ca59aeb05716854937b2787cd8f91..d43702e1e851731d8163b9426077f35f91ef94d5 100644 (file)
@@ -2100,11 +2100,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;
         }