Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Tue, 19 Feb 2002 14:14:38 +0100
From: Kurt Roeckx <Q@ping.be>
To: Pavel Tsekov <ptsekov@syntrex.com>
Cc: cygwin@cygwin.com
Subject: Re: Fwd: Re: Core dumped just only with strcat!
Message-ID: <20020219141438.A1286@ping.be>
References: <2110666337.20020219124535@syntrex.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
In-Reply-To: <2110666337.20020219124535@syntrex.com>; from ptsekov@syntrex.com on Tue, Feb 19, 2002 at 12:45:35PM +0100

On Tue, Feb 19, 2002 at 12:45:35PM +0100, Pavel Tsekov wrote:
> I've trying lots of things and after 1 day with it, I've achieved to work
> part of the code. What I did? I just declared my array before a MYSQL_RES
> variable. I had:
> 
> MYSQL_RES * result;
> char petition[500];

This is basic C knowledge.  Here petition is a local variable, so
it's not filled with '\0'.  You either want to place a '\0' in
petition[0], or use strcpy() instead of strcat().

strcat() will add at the end of the string, and that might be
anywhere in memory since you didn't initialize the string and
just contains garbage.


Kurt


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

