commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r962859 - /commons/proper/daemon/trunk/src/native/nt/procrun/src/registry.c
Date Sat, 10 Jul 2010 15:21:56 GMT
Author: mturk
Date: Sat Jul 10 15:21:55 2010
New Revision: 962859

URL: http://svn.apache.org/viewvc?rev=962859&view=rev
Log:
DAEMON-167: Make sure we provide the size with terminating NUL character when writting to
the registry

Modified:
    commons/proper/daemon/trunk/src/native/nt/procrun/src/registry.c

Modified: commons/proper/daemon/trunk/src/native/nt/procrun/src/registry.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/nt/procrun/src/registry.c?rev=962859&r1=962858&r2=962859&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/nt/procrun/src/registry.c (original)
+++ commons/proper/daemon/trunk/src/native/nt/procrun/src/registry.c Sat Jul 10 15:21:55 2010
@@ -705,7 +705,7 @@ apxRegistrySetStrA(APXHANDLE hRegistry, 
             return FALSE;
     }
     else if (RegSetValueExA(hKey, szValueName, 0, dwType,
-                       (LPBYTE)szValue, lstrlenA(szValue)) != ERROR_SUCCESS)
+                       (LPBYTE)szValue, lstrlenA(szValue) + 1) != ERROR_SUCCESS)
         return FALSE;
 
     return TRUE;
@@ -743,7 +743,7 @@ apxRegistrySetStrW(APXHANDLE hRegistry, 
     }
     else if (RegSetValueExW(hKey, szValueName, 0, dwType,
                        (LPBYTE)szValue,
-                       lstrlenW(szValue) * sizeof(WCHAR)) != ERROR_SUCCESS)
+                       (lstrlenW(szValue) + 1) * sizeof(WCHAR)) != ERROR_SUCCESS)
         return FALSE;
 
     return TRUE;
@@ -836,8 +836,8 @@ LONG apxDeleteRegistryRecursive(HKEY hKe
     while (rc == ERROR_SUCCESS) {
         dwSize = SIZ_BUFLEN;
         rc = RegEnumKeyExW(hKey, 0, szName, &dwSize, NULL, NULL, NULL, NULL );
-       
-        if (rc == ERROR_NO_MORE_ITEMS) {           
+
+        if (rc == ERROR_NO_MORE_ITEMS) {
             rc = RegDeleteKeyW(hKeyRoot, szSubKey);
             break;
         } else {
@@ -846,7 +846,7 @@ LONG apxDeleteRegistryRecursive(HKEY hKe
                 break;   // abort when we start failing
             }
         }
-    }    
+    }
     RegCloseKey(hKey);
     return rc;
 }
@@ -889,12 +889,12 @@ apxDeleteRegistryW(LPCWSTR szRoot,
                 hKey = NULL;
                 rv |= (rc == ERROR_SUCCESS);
             }
-            if (bDeleteEmptyRoot) {  
+            if (bDeleteEmptyRoot) {
                 // will fail if there are subkeys, just like we want
                 RegDeleteKeyW(hkeySoftware, buff);
             }
             RegCloseKey(hkeySoftware);
-        } 
+        }
     }
     return rv;
 }
@@ -1078,7 +1078,7 @@ BOOL apxSetServiceDescriptionW(LPCWSTR s
     }
 
     rc = RegSetValueExW(hKey, REGDESCRIPTION, 0, REG_SZ, (CONST BYTE *)szDescription,
-                        lstrlenW(szDescription) * sizeof(WCHAR));
+                        (lstrlenW(szDescription) + 1) * sizeof(WCHAR));
     SAFE_CLOSE_KEY(hKey);
 
     return rc == ERROR_SUCCESS;



Mime
View raw message