Richard said:
[Not sure what this is doing in csc - followups set to clc]
Thad Smith said:
Sloppy wording breeds meaningless assertions.
A "buffer overflow in C" is not even a proposition, let alone a fact. A
modulo operator is also not a "fact" of C or anything else.
Let's add precision with some propositions:
1. Buffer overflows occur when some programs written in C are run.
2. Buffer overflows occur when all programs written in C are run.
3. Buffer overflows can occur when running most programs written in C
under some conditions of invocation and inputs.
And then let's add:
4. Buffer overflows can sometimes occur when running some carelessly
written programs under some conditions of invocation and inputs,
This idiotic attitude is typical of the people here.
There is nothing wrong, buffer overflows aren't a problem, it is the
fault of the lazy programmers that aren't as clever as they should be.
Typical too is the lack of any software engineering argumentation, and
the desire to always stay in the three main discussions subject of this
group
1: void main(void) is not correct
2: i=I++ + ++i; is not correct
3: Doing lazy student's homework.
Anything that goes beyond that is off topic, for instance a book about
formal analysis of C programs obviously. There is NO NEED for formal
analysis when there are no buffer overflows, all contrary evidence
notwithstanding.
Implicit in this attitude is the attitude of their guru heathfield,
when he just dismisses the problem as above:
"carelessly written programs"... like his book (C unleashed) where
he assumes that sizeof(int) equals sizeof(void *) and gets a buffer
overflow. That he realized his error LATER and put the solution in
the ERRATA should be a reminder to him that not only "carelessly written
programs" happen to contain buffer overflows but that the easy with
which you can do those errors in C is a PROBLEM for C!
But no.
where
these programs are written in any of a variety of languages (certainly
including C, but also including C++ for a start) that are sufficiently
powerful to be capable of being dangerously misused by amateurs.
Yes sure.Those amateurs include heathfield obviously!
If you don't want buffer overflows, hire some good programmers.
Mr heathfield should follow his own advise. When writing a book,
try to hire a good programmer to write the examples.
One way you
can tell they're good is that they hold regular code reviews in which they
point out faults in each others' code.
This did not work in C unleashed.
This did not work in all the buffer overflows we were having in the last
years. And it is extremely expensive.
This attitude is leading to the conclusion for most sensible people that
they should avoid C (and C++) at all costs. Hence languages like Java
and C# appear, where this problem of the C buffer overflow should be
avoided by design.