Defensive programming: Difference between revisions

Content deleted Content added
m clean up, typo(s) fixed: occured → occurred
link to DAB page repaired
Line 144:
===Other Tips to Secure Your Code===
* One of the most common problems is unchecked use of constant-size or pre-allocated structures for dynamic-size data such as inputs to the program (the [[buffer overflow]] problem). This is especially common for [[string (computer programming)|string]] data in [[C (programming language)|C]]. C library functions like <code>gets</code> should never be used since the maximum size of the input buffer is not passed as an argument. C library functions like <code>scanf</code> can be used safely, but require the programmer to take care with the selection of safe format strings, by sanitizing it before using it.
* Encrypt/authenticate all important data transmitted over networks. Do not attempt to implement your own encryption scheme, use a [[Cryptography standards|proven one]] instead. Message checking with [[Cyclic redundancy check|CRC]] or similar technology will also help secure data sent over a network.
 
====The 3 Rules of Data Security====