public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Bill McEnaney" <bill@rkirkpat.net>
To: "Vivek Katakam" <vivek1717@gmail.com>, gcc-help@gcc.gnu.org
Subject: Re: Reg seg. violations
Date: Sun, 16 Jul 2006 22:09:00 -0000	[thread overview]
Message-ID: <20060716220854.5BECD71B2B@saratoga.rkirkpat.net> (raw)

Maybe another problem is that getenv() expects a pointer, not a string
literal.  It seems to me although a pointer can point to a string
literal, a string literal can't point to anything.  If I'm mistaken,
would someone please say so?

Vivek Katakam wrote:

> Hi all
> 
> I  am mainly getting segmentation violation at this code in strlen and
strcpy:
> 
>  printf("Content-type: text/html\n\n");
> line_buffer = (char *) malloc(strlen(getenv("QUERY_STRING")) + 1);
> strcpy(line_buffer, getenv("QUERY_STRING"));
> 
> at strlen and strcpy when QUERY_STRING is not set .
> Is there a way to handle this? there are a lot of such occurrences.
> 
> Regards,
> Vivek
> 
> 

________________________________________________________________
"Pro-choice?"  Then click here.
http://cathinsight.com/morality/saying.htm

"Men must look for the peace of Christ in the Kingdom of Christ... When
once men recognize, both in private and in public life, that Christ is
King, society will at last receive the great blessings of real liberty,
well-ordered discipline, peace and harmony."  Pope Pius XI

             reply	other threads:[~2006-07-16 22:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-16 22:09 Bill McEnaney [this message]
2006-07-17  9:01 ` Andrew Haley
  -- strict thread matches above, loose matches on Subject: below --
2006-07-16 21:57 Bill McEnaney
2006-07-16 18:58 Vivek Katakam

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=20060716220854.5BECD71B2B@saratoga.rkirkpat.net \
    --to=bill@rkirkpat.net \
    --cc=gcc-help@gcc.gnu.org \
    --cc=vivek1717@gmail.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).