Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!apple!sun-barr!newstop!texsun!letni!doug From: doug@letni.UUCP (Doug Davis) Newsgroups: comp.std.c Subject: Re: Out-of-bounds pointers Message-ID: <4199@letni.UUCP> Date: 4 Oct 89 15:31:26 GMT References: <1009@mtxinu.UUCP> Reply-To: doug@letni.LawNet.Com (Doug Davis) Organization: Logic Process Dallas, Texas. Lines: 24 In article <1009@mtxinu.UUCP> ed@mtxinu.COM (Ed Gould) writes: > void > f() { > char bug[100]; ^^^^^^^^^^ I assume you mean buf here, right? > char *p; > > p = buf; > > p--; /* p contains an illegal value: &buf[-1] */ ^^^ Opps, You have now entered the land of illegal addresses, normally called the twilight zone, incrementing the pointer is no longer guarenteed to be == &buf[0], that is installation dependent. Most likely it will == something really weird and you get a core dump. Which one you get is left as an exercise to the reader. doug __ Doug Davis/1030 Pleasant Valley Lane/Arlington/Texas/76015/817-467-3740 {sys1.tandy.com, motown!sys1, uiucuxc!sys1 lawnet, attctc, texbell} letni!doug "ack, pifft! RRREEEEAAAAAWWWWOOOOOO!" -- Sound effects from the "Bill The Cat'lprod(TM)" Commercial, Available in better hardware stores near you.