prunsrv.exe fails if filename is less than 4 characters long
------------------------------------------------------------

         Key: DAEMON-85
         URL: http://issues.apache.org/jira/browse/DAEMON-85
     Project: Commons Daemon
        Type: Bug

    Versions: 1.0.1 Final    
 Environment: Win2k
    Reporter: Michael Goddard


In cmdline.c, function apxCmdlineParse the following three lines check if the 
length if arg[0] is greater than the length of .EXE.

However on windows, exe's can be executed without their .exe prefix. This 
means, if prunsrv.exe is renamed to 3 characters or less, the check fails and 
command line arguments arn't parsed returning an error. I could not figure out 
why the check is there, it seems to serve no purpose and if commented out the 
bug goes away.

Code at fault:

    l = lstrlenW(_st_sys_argvw[0]);
    if (l < EXE_SUFFIXLEN)
        return NULL;

To reproduce:

1. Rename prunsrv.exe to say abc.exe
2. Execute the service executable directly as 'abc' in the current folder, do 
not type 'abc.exe'. (useful to use when debugging the app)
3. See it fail to parse command line arguments

To solve:

Remove offending lines. Perhaps check if arg[0] length is less than or equal to 
0 instead of 4, which would be a valid case to fail in.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to