[patch] burncd: honour for envar SPEED

Nate Eldredge nate at thatsmathematics.com
Tue Nov 10 16:03:28 UTC 2009

On Tue, 10 Nov 2009, Alexander Best wrote:

> ps: would be nice if strcasecmp could protect itself from segfault with one or
> both of the args being NULL.

I disagree.  What do you think it should do instead?  Return 0?  If it 
did, would you have found your bug?

The same argument could be made for any of the string.h functions, but I 
don't think it actually holds water.  Such checks add overhead, and only 
provide an illusion of safety.  Sure, strcasecmp could avoid causing the 
segfault itself, but at the cost of letting a broken program continue and 
possibly cause more damage.  It could call abort(), but then you'd just 
have the same result (program terminates) with a different signal, and 
doing your check in software rather than letting the MMU hardware do it. 
It could print a message, but that pollutes the program's output, and 15 
seconds debugging the core dump will reveal the problem anyway.

Having a library function "protect itself" in this manner is not actually 
helpful, IMHO.


Nate Eldredge
nate at thatsmathematics.com

More information about the freebsd-hackers mailing list