]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Fix heap corruption in co-installer
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 7 Oct 2014 14:55:49 +0000 (15:55 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 7 Oct 2014 14:55:49 +0000 (15:55 +0100)
The co-installer was corrupting its heap by trying to free a pointer after
incrementing it from its original value.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/coinst/coinst.c
src/xenbus.inf

index 27d3211282f10ee7f738f6a3a1f1c0dacba71dc8..59726f58c36ddeab9b9b2dcb7fe8f3960380fa39 100644 (file)
@@ -1132,6 +1132,7 @@ MatchExistingDriver(
     DWORD   MaxValueLength;
     DWORD   DriverDescLength;
     PTCHAR  DriverDesc = NULL;
+    DWORD   ProductNameLength;
     DWORD   Type;
 
     // Look for a legacy platform device
@@ -1213,16 +1214,17 @@ found:
         goto fail9;
     }
 
+    ProductNameLength = (DWORD)strlen(PRODUCT_NAME_STR);
+
     if (strncmp(DriverDesc,
                 PRODUCT_NAME_STR,
-                strlen(PRODUCT_NAME_STR)) != 0) {
+                ProductNameLength) != 0) {
         SetLastError(ERROR_INSTALL_FAILURE);
         goto fail10;
     }
 
-    DriverDesc += strlen(PRODUCT_NAME_STR);
-
-    if (strcmp(DriverDesc, " PV Bus") != 0) {
+    if (strcmp(DriverDesc + ProductNameLength,
+               " PV Bus") != 0) {
         SetLastError(ERROR_INSTALL_FAILURE);
         goto fail11;
     }
index fe01c792187af66a8bfc859fc53e4355128bfa9a..544bb2c43fc0f31fe5ab98aa3278554eabc390c8 100644 (file)
@@ -72,8 +72,8 @@ xenbus_coinst_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.dll
 CopyFiles=XenBus_Copyfiles
 
 [XenBus_Inst.Services] 
-AddService=xenfilt,,XenFilt_Service,
 AddService=xenbus,0x02,XenBus_Service,
+AddService=xenfilt,,XenFilt_Service,
 
 [XenBus_Service] 
 DisplayName=%XenBusDesc%