Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: tlug: more gcc crap
- To: <tlug@example.com>
- Subject: Re: tlug: more gcc crap
- From: "Damian Foo" <damianfm@example.com>
- Date: Thu, 5 Mar 1998 11:29:16 +0800
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain;charset="iso-8859-1"
- Reply-To: tlug@example.com
- Sender: owner-tlug@example.com
> >Ok, suppose I have a variable: > >char *s0; > >it's been malloced with > >s0=(char *)malloc(80); > >The function it's in does: > >sprintf(s0,"some_text %s some_text",some_other_string_var); >newtWinMessage("Title","Ok",s0); > I had the same problem and solved it by truncating some_other_string_var with the exact size of 80 bytes. sprintf generally stops at the first null terminator in a variable. If that is exceeded then s0 has an allocation overflow which will result in Segment Fault. Let me know if that works !! >(everything works just fine so far). > >Then I have a line: > >if (s0) free(s0); > >This causes a segmentation fault. gdb output is: > >Breakpoint 1, doFindPackages (state=0x806a4d8) at turboupgrade.c:261 >261 if (s0) free(s0); >(gdb) n > >Program received signal SIGSEGV, Segmentation fault. >0x400ed7a9 in __libc_free () > > >what the heck causes something like this? It seems like the if clause >would prevent this sort of crap.. it's acting like I'm trying to free an >un-malloced pointer... > >-------------------------------------------------- >Scott M. Stone <sstone@example.com, sstone@example.com> > <sstone@example.com> >Linux Developer/Systems Administrator for Pacific HiTech, Inc. >http://www.pht.com http://armadillo.pht.co.jp >http://www.pht.co.jp http://www.turbolinux.com > > >--------------------------------------------------------------- >Next TLUG Nomikai: 11 March Wed 1998 Tengu TokyoEkiMae 19:30 >Chuo-ku, Kyobashi 1-1-6, EchiZenYa Bld. B1/B2 03-3275-3691 >Next TLUG Meeting: 11 April 1998 Saturday, Tokyo Station >Featuring Tague Griffith of Netscape i18n talking on source code >--------------------------------------------------------------- >a word from the sponsor: >TWICS - Japan's First Public-Access Internet System >www.twics.com info@example.com Tel:03-3351-5977 Fax:03-3353-6096 > --------------------------------------------------------------- Next TLUG Nomikai: 11 March Wed 1998 Tengu TokyoEkiMae 19:30 Chuo-ku, Kyobashi 1-1-6, EchiZenYa Bld. B1/B2 03-3275-3691 Next TLUG Meeting: 11 April 1998 Saturday, Tokyo Station Featuring Tague Griffith of Netscape i18n talking on source code --------------------------------------------------------------- a word from the sponsor: TWICS - Japan's First Public-Access Internet System www.twics.com info@example.com Tel:03-3351-5977 Fax:03-3353-6096
Home | Main Index | Thread Index
- Prev by Date: Re: tlug: more gcc crap
- Next by Date: tlug: DAT tape drive
- Prev by thread: Re: tlug: more gcc crap
- Next by thread: tlug: Open Source
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links