Defensive programming: Difference between revisions

Content deleted Content added
QuickFox (talk | contribs)
Turned "aspect oriented programming" into a link to article
mNo edit summary
Line 8:
<!-- Please expand this article. These random notes should be changed to a more coherent article. -->
 
* One of the most common problems is unchecked use of constant-size structures and functions for dynamic-size data (the [[buffer overflow]] problem). This is especially common for [[string]] data in [[C programming language|C]]. C library functions like <tt>gets</tt> and <tt>scanf</tt> should never be used since the maximum size of the input buffer is not passed as an argument. C library functions like <tt>scanf</tt> can be used safely, but require care with the selection of safe format strings.
* Never make code more complex than necessary. Complexity breeds bugs, including security problems.
* Either leave the code available to everyone on the Net (see [[Free software]] or [[Open Source Definition]]) or hire someone who will perform a software [[security audit]].
* If possible, reuse code instead of writing from scratch.
* Encrypt all important data transmitted over networks. Do not attempt to implement your own encryption scheme, but use a proven one instead.
* All data is important until proven otherwise.
* All code is insecure until proven otherwise.