Secure coding: Difference between revisions

Content deleted Content added
Wiki.0905 (talk | contribs)
m Added hyperlink
Removing link(s) to "Secure by default": Removing links to deleted page Secure by default.
 
(2 intermediate revisions by one other user not shown)
Line 24:
// copy a maximum of BUF_SIZE bytes
strncpy(dst, user_input, BUF_SIZE);
// set the last character in the buffer to NUL.
dst[BUF_SIZE -1] = '\0';
}
</syntaxhighlight>Another secure alternative is to dynamically allocate memory on the heap using [[malloc]].<syntaxhighlight lang="c++">
Line 80 ⟶ 82:
* [[Defensive programming]]
* [[Security bug]]
* [[Secure by default]]
 
== Notes ==