You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jack Cai (JIRA)" <ji...@apache.org> on 2008/12/08 15:18:44 UTC
[jira] Created: (DAEMON-118) Insufficient memory allocation and
unnecessary quotes insertion
Insufficient memory allocation and unnecessary quotes insertion
---------------------------------------------------------------
Key: DAEMON-118
URL: https://issues.apache.org/jira/browse/DAEMON-118
Project: Commons Daemon
Issue Type: Bug
Affects Versions: 1.0.1
Reporter: Jack Cai
When reading the source file rprocess.c in Commons Daemon procrun project, I found a defect in the method __apxStrQuote() and apxProcessSetCommandArgsW().
In __apxStrQuote(), I don't think it is necessary to add quotes around a command line argument whenever a space/tab/quote/backslash is found. Usually users add quote around an argument by themselves if the argument contains space. So adding anothe pair of quotes around the argument only get things wrong. I'd suggest the quote is only inserted when there is space/tab but no quote found in the argument. Also, it is not necessary to convert backslash into double backslash for a string that's already in memory.
In apxProcessSetCommandArgsW(), the algorithm for calculating the buffer length is incorrect, as it does take the backslash to double backslash expansion. But if the above suggestion for __apxStrQuote() is accepted, the defect will disappear, and there is also no need to allocate memory for each quote character.
I'll attach the suggested patch.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DAEMON-118) Insufficient memory allocation and
unnecessary quotes insertion
Posted by "Jack Cai (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DAEMON-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jack Cai updated DAEMON-118:
----------------------------
Attachment: DAEMON-118_Jack.patch
Providing a fix.
> Insufficient memory allocation and unnecessary quotes insertion
> ---------------------------------------------------------------
>
> Key: DAEMON-118
> URL: https://issues.apache.org/jira/browse/DAEMON-118
> Project: Commons Daemon
> Issue Type: Bug
> Affects Versions: 1.0.1
> Reporter: Jack Cai
> Attachments: DAEMON-118_Jack.patch
>
>
> When reading the source file rprocess.c in Commons Daemon procrun project, I found a defect in the method __apxStrQuote() and apxProcessSetCommandArgsW().
> In __apxStrQuote(), I don't think it is necessary to add quotes around a command line argument whenever a space/tab/quote/backslash is found. Usually users add quote around an argument by themselves if the argument contains space. So adding anothe pair of quotes around the argument only get things wrong. I'd suggest the quote is only inserted when there is space/tab but no quote found in the argument. Also, it is not necessary to convert backslash into double backslash for a string that's already in memory.
> In apxProcessSetCommandArgsW(), the algorithm for calculating the buffer length is incorrect, as it does take the backslash to double backslash expansion. But if the above suggestion for __apxStrQuote() is accepted, the defect will disappear, and there is also no need to allocate memory for each quote character.
> I'll attach the suggested patch.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DAEMON-118) Insufficient memory allocation and
unnecessary quotes insertion
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DAEMON-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb updated DAEMON-118:
------------------------
Fix Version/s: 1.0.2
> Insufficient memory allocation and unnecessary quotes insertion
> ---------------------------------------------------------------
>
> Key: DAEMON-118
> URL: https://issues.apache.org/jira/browse/DAEMON-118
> Project: Commons Daemon
> Issue Type: Bug
> Affects Versions: 1.0.1
> Reporter: Jack Cai
> Fix For: 1.0.2
>
> Attachments: DAEMON-118_Jack.patch
>
>
> When reading the source file rprocess.c in Commons Daemon procrun project, I found a defect in the method __apxStrQuote() and apxProcessSetCommandArgsW().
> In __apxStrQuote(), I don't think it is necessary to add quotes around a command line argument whenever a space/tab/quote/backslash is found. Usually users add quote around an argument by themselves if the argument contains space. So adding anothe pair of quotes around the argument only get things wrong. I'd suggest the quote is only inserted when there is space/tab but no quote found in the argument. Also, it is not necessary to convert backslash into double backslash for a string that's already in memory.
> In apxProcessSetCommandArgsW(), the algorithm for calculating the buffer length is incorrect, as it does take the backslash to double backslash expansion. But if the above suggestion for __apxStrQuote() is accepted, the defect will disappear, and there is also no need to allocate memory for each quote character.
> I'll attach the suggested patch.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (DAEMON-118) Insufficient memory allocation and
unnecessary quotes insertion
Posted by "Mladen Turk (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DAEMON-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mladen Turk resolved DAEMON-118.
--------------------------------
Resolution: Fixed
Committed as r907260. I clean the patch bz removing the commented code. Thanks
> Insufficient memory allocation and unnecessary quotes insertion
> ---------------------------------------------------------------
>
> Key: DAEMON-118
> URL: https://issues.apache.org/jira/browse/DAEMON-118
> Project: Commons Daemon
> Issue Type: Bug
> Affects Versions: 1.0.1
> Reporter: Jack Cai
> Attachments: DAEMON-118_Jack.patch
>
>
> When reading the source file rprocess.c in Commons Daemon procrun project, I found a defect in the method __apxStrQuote() and apxProcessSetCommandArgsW().
> In __apxStrQuote(), I don't think it is necessary to add quotes around a command line argument whenever a space/tab/quote/backslash is found. Usually users add quote around an argument by themselves if the argument contains space. So adding anothe pair of quotes around the argument only get things wrong. I'd suggest the quote is only inserted when there is space/tab but no quote found in the argument. Also, it is not necessary to convert backslash into double backslash for a string that's already in memory.
> In apxProcessSetCommandArgsW(), the algorithm for calculating the buffer length is incorrect, as it does take the backslash to double backslash expansion. But if the above suggestion for __apxStrQuote() is accepted, the defect will disappear, and there is also no need to allocate memory for each quote character.
> I'll attach the suggested patch.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.