public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Newbie problem: Address out of bounds
@ 2003-09-19  1:44 Andre Kirchner
  2003-09-19  2:32 ` Eljay Love-Jensen
  0 siblings, 1 reply; 3+ messages in thread
From: Andre Kirchner @ 2003-09-19  1:44 UTC (permalink / raw)
  To: gcc-help

Hi,

does anyone know what is wrong with the following
code? Somehow when the program gets inside the "if"
block it loses the value of webAddress( which is a
char[ 256 ] ), and the debuger ( I'm using KDevelop )
shows this message "webAddress=0x2f3c3e61 <Address
0x2f3c3e61 out of bounds >".

Thanks a lot,

Andre


while( getLine( theLine, sockfd ) == 0 )
  if( checkString( theLine, "href=", ".jpg" ) == 0 )
  {
    bzero( newLink, 256 );
    bzero( newTarget, 256 );

    getTargetName( newTarget, theLine );
    replaceTarget( newLink, webAddress, newTarget );
    fprintf( theFile, "%s\n", newLink );
  }

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Newbie problem: Address out of bounds
  2003-09-19  1:44 Newbie problem: Address out of bounds Andre Kirchner
@ 2003-09-19  2:32 ` Eljay Love-Jensen
  2003-09-19  5:59   ` Andre Kirchner
  0 siblings, 1 reply; 3+ messages in thread
From: Eljay Love-Jensen @ 2003-09-19  2:32 UTC (permalink / raw)
  To: Andre Kirchner, gcc-help

Hi Andre,

Does getLine '\0' terminate the line?

Does getLine assure that not to overrun the theLine's buffer size, including the terminator?  (And, if so, how does getLine know how big theLine's buffer is?)

The bzero function is rather non-portable, as it is not a required part of ANSI or System V.  (I think that harkens back to the days of BCPL.)  A portable alternative is memset(ptr, 0x00, 256); instead.

HTH,
--Eljay


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Newbie problem: Address out of bounds
  2003-09-19  2:32 ` Eljay Love-Jensen
@ 2003-09-19  5:59   ` Andre Kirchner
  0 siblings, 0 replies; 3+ messages in thread
From: Andre Kirchner @ 2003-09-19  5:59 UTC (permalink / raw)
  To: Eljay Love-Jensen, gcc-help

Hi Eljay,

that was exactly what was happining with therLine at
getLine.

Thanks for your help,

Andre 


--- Eljay Love-Jensen <eljay@adobe.com> wrote:
> Hi Andre,
> 
> Does getLine '\0' terminate the line?
> 
> Does getLine assure that not to overrun the
> theLine's buffer size, including the terminator? 
> (And, if so, how does getLine know how big theLine's
> buffer is?)
> 
> The bzero function is rather non-portable, as it is
> not a required part of ANSI or System V.  (I think
> that harkens back to the days of BCPL.)  A portable
> alternative is memset(ptr, 0x00, 256); instead.
> 
> HTH,
> --Eljay
> 
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-09-19  5:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-19  1:44 Newbie problem: Address out of bounds Andre Kirchner
2003-09-19  2:32 ` Eljay Love-Jensen
2003-09-19  5:59   ` Andre Kirchner

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).