[TAG] Compliments to you all.
ben at callahans.org
Sat Jun 5 17:53:36 MSD 2004
On Fri, Jun 04, 2004 at 08:39:38PM -0400, Tom Brown wrote:
> Whoops, I was looking at the wrong argument. Thomas is right. The "for"
> loop runs one time too many. It shouldn't have been "i<= SIZE", since the
> buffer array actually goes from zero to SIZE-1, and the result hammers the next
> byte in memory, "buf1[SIZE]". Voila! Buffer overrun due to another Stupid
> Coding Trick (forgetting the "minus one" max offset), and you get an input too
> big for the bucket.
> No Excuse: I've been using Object Pascal for the last 7 years, which doesn't
> have any of C's craziness. How quickly I forgot all that pain and suffering!
That's why I don't recommend C except as a learning tool, or something
to be practiced under the stern eye of a True Wizard until your own
abilities are at a reasonably high level. Unfortunately, most C code by
far (in my opinion) is written by people who are still in that initial
learning curve. Hence, the world of pain and suffering.
* Ben Okopnik * okopnik.freeshell.org * Editor-in-Chief, Linux Gazette *
-*- See the Linux Gazette in its new home: <http://linuxgazette.net> -*-
More information about the TAG