Article View: comp.std.c
Article #663Re: Out-of-bounds pointers
From: Doug Davis
Date: Wed, 04 Oct 1989 15:31
Date: Wed, 04 Oct 1989 15:31
24 lines
1464 bytes
1464 bytes
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! <ZOT> RRREEEEAAAAAWWWWOOOOOO!" -- Sound effects from the "Bill
The Cat'lprod(TM)" Commercial, Available in better hardware stores near you.
Technical Details
Message-ID:
<4199@letni.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!apple!sun-barr!newstop!texsun!letni!dougReferences:
<1009@mtxinu.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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