From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5684 invoked by alias); 16 Jul 2006 22:09:02 -0000 Received: (qmail 5672 invoked by uid 22791); 16 Jul 2006 22:09:01 -0000 X-Spam-Check-By: sourceware.org Received: from saratoga.rkirkpat.net (HELO saratoga.rkirkpat.net) (206.196.156.29) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 16 Jul 2006 22:08:56 +0000 Received: by saratoga.rkirkpat.net (Postfix, from userid 33) id 5BECD71B2B; Sun, 16 Jul 2006 16:08:54 -0600 (MDT) From: "Bill McEnaney" To: "Vivek Katakam" , gcc-help@gcc.gnu.org Subject: Re: Reg seg. violations X-Mailer: NeoMail 1.22 X-IPAddress: 72.224.42.210 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Message-Id: <20060716220854.5BECD71B2B@saratoga.rkirkpat.net> Date: Sun, 16 Jul 2006 22:09:00 -0000 X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-07/txt/msg00209.txt.bz2 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