celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Broekhuis (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CELIX-214) Unsafe strtok() usage
Date Fri, 06 Feb 2015 19:23:34 GMT

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

Alexander Broekhuis commented on CELIX-214:
-------------------------------------------

To prevent problems like those, strtok should not be used. With APR we used apr_strtok, which
uses a pointer to keep track of the status. This makes it possible to use strtok in a recursive
way.
Since C-2001 there is a strtok_r as well, it uses (like apr_strtok) a pointer to keep track.
This one is used in several places already, so I'm going to assume C-2001 is no problem. So
I think I'm going to create a new issue to replace strtok with strtok_r all over the place
instead of only in this instance.

> Unsafe strtok() usage
> ---------------------
>
>                 Key: CELIX-214
>                 URL: https://issues.apache.org/jira/browse/CELIX-214
>             Project: Celix
>          Issue Type: Bug
>            Reporter: Daniel Parker
>
> start_command.c::startCommand_execute() cannot use strtok() safely because strtok() is
used by some of the functions that end up being invoked by it on down the line.
> Valgrind stack trace of the error:
> ==28542==    by 0x1F0EDD53: endpointDiscoveryPoller_create (endpoint_discovery_poller.c:99)
> ==28542==    by 0x1F0EBF4B: discovery_start (discovery_impl.c:81)
> ==28542==    by 0x1F0EC2D3: bundleActivator_start (discovery_activator.c:141)
> ==28542==    by 0x4857A5B: fw_startBundle (framework.c:700)
> ==28542==    by 0x484E783: bundle_startWithOptions (bundle.c:311)
> ==28542==    by 0x56FD45F: startCommand_execute (start_command.c:67)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message