You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mladen Turk (JIRA)" <ji...@apache.org> on 2010/02/11 17:18:28 UTC

[jira] Closed: (DAEMON-85) prunsrv.exe fails if filename is less than 4 characters long

     [ https://issues.apache.org/jira/browse/DAEMON-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mladen Turk closed DAEMON-85.
-----------------------------

    Resolution: Won't Fix

The extension check is needed because it is required to strip the cpu specific extensions.
You can have servicename.x86.exe that will evaluate to the servicename


> prunsrv.exe fails if filename is less than 4 characters long
> ------------------------------------------------------------
>
>                 Key: DAEMON-85
>                 URL: https://issues.apache.org/jira/browse/DAEMON-85
>             Project: Commons Daemon
>          Issue Type: Bug
>    Affects Versions: 1.0.1
>         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.
-
You can reply to this email to add a comment to the issue online.