What every C Programmer should know about undefined behavior #2/3
What every C Programmer should know about undefined behavior #2/3
Posted May 17, 2011 8:38 UTC (Tue) by stijn (subscriber, #570)In reply to: What every C Programmer should know about undefined behavior #2/3 by nix
Parent article: What every C Programmer should know about undefined behavior #2/3
Also, a buffer overrun in any other language will generally imply the application is buggy and will yield at the very least corrupt results, and similarly for NULL pointer dereferencing and other off-the rails events. C might just blow up a bit harder, and unfortunately make a bigger hole as a result. There are plenty of remedies outside the C language; there's different defense vectors just as there are different attack vectors. The worst and weakest C wart IMHO are \0-terminated strings. As a result we get duplicate mem and str libraries, already a good indication something is amiss. Reasoning about \0-terminated strings is hard, not because of buffer sizes, but because you always have to make sure that no stowaway \0 can possibly be present inside your string.
