Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 22142 invoked from network); 13 Dec 2008 07:41:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Dec 2008 07:41:38 -0000 Received: (qmail 75525 invoked by uid 500); 13 Dec 2008 07:41:50 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 75517 invoked by uid 500); 13 Dec 2008 07:41:50 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 75505 invoked by uid 99); 13 Dec 2008 07:41:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Dec 2008 23:41:49 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of saju.pillai@gmail.com designates 209.85.218.16 as permitted sender) Received: from [209.85.218.16] (HELO mail-bw0-f16.google.com) (209.85.218.16) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Dec 2008 07:41:35 +0000 Received: by bwz9 with SMTP id 9so5005223bwz.0 for ; Fri, 12 Dec 2008 23:41:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=/1dovqrS1+a9G/OXNY1qWxOmts60q2s9ar6qbCUQXMw=; b=iUSxOPf0bht/fsRyrB0b+nqQAetq9wcRoCwbrCMEEWJxmOYVpOwsin25DipiTGRzJW MrCf9TMNWI/7DVjvgjesoV3wGaLi79DwJvnyG2AxZOu8WOP0BAETCEmi0eag+dtrOXTj g5KqDleoerrfy/+bFU85N2IdXF2m3rkJbDrm8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=UU8KkAcH3UeHuH9v3QzoICXrqUCH3j3/2o+H5t6xZodTBv0vTmlEFnYbxWdmZULns9 DMi9f1JAJpa6phBSIY6HMGoUzljANUiKfroM2sTGo0/N+N1RBap6zebULo13ArqMFzSI sZtDrktTIzHuBMvWarbOeWvBm+D2x7ITlaqQg= Received: by 10.223.116.205 with SMTP id n13mr4969598faq.103.1229154074562; Fri, 12 Dec 2008 23:41:14 -0800 (PST) Received: by 10.223.105.130 with HTTP; Fri, 12 Dec 2008 23:41:14 -0800 (PST) Message-ID: <13c255070812122341yf0fe110o8c6943093a39361d@mail.gmail.com> Date: Sat, 13 Dec 2008 13:11:14 +0530 From: "Saju Pillai" To: modules-dev@httpd.apache.org Subject: Re: understanding apr_strtok() In-Reply-To: <04AF8576-4B87-43B7-88C5-725858574BBE@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <8d38ca0a0812122256r5104bcb9l357e18577b6ff3d5@mail.gmail.com> <49436505.5070706@pixar.com> <04AF8576-4B87-43B7-88C5-725858574BBE@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org 2008/12/13 Saju Pillai : > > 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. Sorry - I meant that explicitly defined strings would usually be stuffed into read only memory. You want to copy your string onto heap. [ignore blabber about function stack] -srp > > srp > -- > http://saju.net.in >