From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: linux-c-programming@vger.kernel.org
Subject: Re: strtok_r crashing
Date: Thu, 14 Nov 2002 13:50:13 +0100 [thread overview]
Message-ID: <20021114125013.GN1525@lug-owl.de> (raw)
In-Reply-To: <OF8E547BE6.AC22B859-ON65256C71.0045BBB6@pune.tcs.co.in>
[-- Attachment #1: Type: text/plain, Size: 852 bytes --]
On Thu, 2002-11-14 18:16:04 +0530, Hemant Mohan <hemantm@pune.tcs.co.in>
wrote in message <OF8E547BE6.AC22B859-ON65256C71.0045BBB6@pune.tcs.co.in>:
> Hi,
>
> I am trying to parse a string using strtok_r (I need reentrant code) as
> follows:
>
> #include <string.h>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main()
> {
> char *str = NULL;
> char *temp = NULL;
> char **ptr = NULL; // Note that this is a char**
Note that there's no memory allocated for *ptr.
> This code receives a SIGSEGV in strtok_r.
Surely. Accessing random memory.
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur
fuer einen Freien Staat voll Freier Bürger" | im Internet!
Shell Script APT-Proxy: http://lug-owl.de/~jbglaw/software/ap2/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2002-11-14 12:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-14 12:46 strtok_r crashing Hemant Mohan
2002-11-14 12:50 ` Jan-Benedict Glaw [this message]
2002-11-15 5:45 ` Hemant Mohan
2002-11-15 6:26 ` Glynn Clements
2002-11-15 6:42 ` Hemant Mohan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021114125013.GN1525@lug-owl.de \
--to=jbglaw@lug-owl.de \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).