commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1003792 - in /commons/proper/daemon/trunk/src/native/windows: apps/prunsrv/prunsrv.c src/registry.c
Date Sat, 02 Oct 2010 13:08:30 GMT
Author: mturk
Date: Sat Oct  2 13:08:30 2010
New Revision: 1003792

URL: http://svn.apache.org/viewvc?rev=1003792&view=rev
Log:
Guard against invalid and missing service name. Display human readable error

Modified:
    commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c
    commons/proper/daemon/trunk/src/native/windows/src/registry.c

Modified: commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c?rev=1003792&r1=1003791&r2=1003792&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c (original)
+++ commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c Sat Oct  2 13:08:30
2010
@@ -385,6 +385,11 @@ static BOOL loadConfiguration(LPAPXCMDLI
     APXHANDLE hRegistry;
     int i = 0;
 
+    if (!lpCmdline->szApplication) {
+        /* Handle empty service names */
+        apxLogWrite(APXLOG_MARK_WARN "No service name provided");
+        return FALSE;           
+    }
     SetLastError(ERROR_SUCCESS);
     hRegistry = apxCreateRegistryW(gPool, KEY_READ | KREG_WOW6432,
                                    PRG_REGROOT,

Modified: commons/proper/daemon/trunk/src/native/windows/src/registry.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/windows/src/registry.c?rev=1003792&r1=1003791&r2=1003792&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/windows/src/registry.c (original)
+++ commons/proper/daemon/trunk/src/native/windows/src/registry.c Sat Oct  2 13:08:30 2010
@@ -236,10 +236,14 @@ apxCreateRegistryW(APXHANDLE hPool, REGS
     HKEY      hSparamKey = NULL;
     HKEY      hUparamKey = NULL;
 
-    if (!szKeyName || lstrlenW(szKeyName) > SIZ_RESMAX)
+    if (!szKeyName || lstrlenW(szKeyName) > SIZ_RESMAX) {
+        SetLastError(ERROR_INVALID_PARAMETER);
         return NULL;
-    if (szRoot && lstrlenW(szRoot) > SIZ_RESMAX)
+    }
+    if (szRoot && lstrlenW(szRoot) > SIZ_RESMAX) {
+        SetLastError(ERROR_INVALID_PARAMETER);
         return NULL;
+    }
 
     /* make the HKLM\\SOFTWARE key */
     lstrcpyW(buff, REGSOFTWARE_ROOT);



Mime
View raw message