On 11/10/06, patrick ~ <[EMAIL PROTECTED]> wrote:
--- Charles Longeau <[EMAIL PROTECTED]> wrote:

> If you have a look at ray@ 's undeadly article [0], you will see that
> assuming strlen(buf) > 0 is wrong because :


I am not sure, but I think the case of the first
example (undeadly post [0]) where return value of
fgets(3) isn't checked for NULL and immediately
using 'strlen(buf)-1' to remove '\n' is incorrect.

However, within context, if you are assuming there
may be binary data read in from the stream, then
the entire function rad_config has problems, since
it is assuming non-binary data in buf.  Therefore,
much evasive changes are required to address this
issue than the proposed diff.


Maybe you are taking the undeadly post [0] too
literally in all your changes?


It's still useful to standardize everything and be very explicit in
all your assumptions, just like in math. Perhaps some bug will supply
binary data by accident? Perhaps some cosmic ray will make the machine
state inconsistent in between the start of the function and the
fgets() such that there is a null there at the start of the string?
And going your route, where we consider context for every case, just
leads confusion.

-Nick

Reply via email to