You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by "Pepijn Noltes (Commented) (JIRA)" <ji...@apache.org> on 2012/03/07 14:28:59 UTC

[jira] [Commented] (CELIX-32) serviceTracker_create method creates wrong filter

    [ https://issues.apache.org/jira/browse/CELIX-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13224322#comment-13224322 ] 

Pepijn Noltes commented on CELIX-32:
------------------------------------

Note that the serviceTracker_create methods calls the serviceTracker_createWithFilter method. The latter should also allocate memory in which case the filter string will be allocated twice. This is not optimal and maybe a third (static) method should be created (serviceTracker_createWithFilter2) which a extra argument if memory should be allocated for the provided filter.
                
> serviceTracker_create method creates wrong filter
> -------------------------------------------------
>
>                 Key: CELIX-32
>                 URL: https://issues.apache.org/jira/browse/CELIX-32
>             Project: Celix
>          Issue Type: Bug
>            Reporter: Pepijn Noltes
>
> The serviceTracker_create method uses strcpy and strcat to create a filter from a provided service name. The algorithm contains a bug a writes 1 byte to much to the allocated memory.
> Solution: instead of strcat/strcpy use apr_pstrcat:
> char *filter  = apr_pstrcat(pool, "(", OBJECTCLASS, "=", service, ")", NULL);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira