Skip to content

Commit

Permalink
Add reference to discussion on variadic functions
Browse files Browse the repository at this point in the history
Closes #53
  • Loading branch information
lefticus authored Sep 28, 2016
1 parent b9006b8 commit e44c92b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 04-Considering_Safety.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ But consider refactoring of program logic (for example, additional checking on o
Variadic functions can accept a variable number of parameters. The probably best known example is printf(). You have the possibility to define this kind of functions by yourself but this is a possible security risk. The usage of variadic functions is not type safe and the wrong input parameters can cause a program termination with an undefined behavior. This undefined behavior can be exploited to a security problem.
If you have the possibility to use a compiler that supports C++11, you can use variadic templates instead.

[It is technically possible to make typesafe C-style variadic functions with some compilers](https://github.com/lefticus/cppbestpractices/issues/53)

## Additional Resources

[How to Prevent The Next Heartbleed](http://www.dwheeler.com/essays/heartbleed.html) by David Wheeler is a good analysis of the current state of code safety and how to ensure safe code.

0 comments on commit e44c92b

Please sign in to comment.