httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saju Pillai <>
Subject Re: understanding apr_strtok()
Date Sat, 13 Dec 2008 07:35:23 GMT

On 13-Dec-08, at 1:02 PM, Mark Harrison wrote:

> Sam Carleton wrote:
>> I am trying to use apr_strtok() for the first time.  I am taking the
>> add_cookie() function from mod_rewrite.c, no changes.  I am passing  
>> in
>> the string, variable 's':
>> KioskViewingStation:KVS_VERSION::5
>> The first line that executes in the function is:
>>    char *tok_cntx;
>>    var = apr_strtok(s, ":", &tok_cntx);
>> I am getting an access violation.  I have tried initializing tok_cntx
>> to NULL, but that does not seem to have any impact.  What is the
>> correct way to use apr_strtok()?
>> Sam
> One thing you can check:
> Make sure that s points to writable memory.

Check that s is on the heap not on a function stack. Try  
apr_pstrdup(p, s) or memcpy(s) into malloc'd memory.


View raw message