From ee0bd3f7716546f679bd390d7b681fedf949b2fb Mon Sep 17 00:00:00 2001 From: Marcin Zelent Date: Wed, 30 May 2018 18:27:51 +0200 Subject: Added buffer overflow example --- synopsis.tex | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'synopsis.tex') diff --git a/synopsis.tex b/synopsis.tex index e844895..9c115c8 100644 --- a/synopsis.tex +++ b/synopsis.tex @@ -740,5 +740,31 @@ INSERT INTO Comments VALUES('attacker','hello '); \end{minted} +\newpage + +\appendix +\section{Buffer overflow example} + +\subsection{buffer-overflow.c} +\begin{minted}{c} +#include +#include + +int main(void) +{ + char buf[16]; + int ok = 0; + + printf("Type admin password: \n"); + gets(buf); + + if (strcmp(buf, "pass123")) printf("\nWrong password!\n"); + else ok = 1; + + if (ok) printf("\nLogged in as admin.\n"); + + return 0; +} +\end{minted} \end{document} -- cgit v1.2.3