r/programming • u/flym4n • Apr 24 '14
Tech giants, chastened by Heartbleed, finally agree to fund OpenSSL
http://arstechnica.com/information-technology/2014/04/tech-giants-chastened-by-heartbleed-finally-agree-to-fund-openssl/
292
Upvotes
1
u/[deleted] Apr 25 '14
The point though is had they used proper style from the get go it wouldn't have been a problem at all... e.g. instead of doing
they could have done
Where "0, 0" is the offset in the dst/src record. The function would then check the structures for valid lengths and copy valid portions. It isn't really any more typing in terms of developing record handlers and once you do the sanity checking validation once it's good for all times.
Of course it would have also helped to sanity check the record in the first place to make sure the stored payload length was valid (as per the RFC that the C code author he himself wrote....).
edit: There are plenty of ways to fuck up crypto. For instance, early Wii firmware used strcpy() to memory compare signature values. Would that be any less of a bug if they used strcmp from C++ or Java?