summaryrefslogtreecommitdiff
path: root/3p37.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3p37.cpp')
-rw-r--r--3p37.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/3p37.cpp b/3p37.cpp
new file mode 100644
index 0000000..968ce86
--- /dev/null
+++ b/3p37.cpp
@@ -0,0 +1,26 @@
+#include <iostream>
+#include <vector>
+#include "sales_data.hpp"
+#include "sales_item.hpp"
+
+/*
+ *
+ * 3.37
+ *
+ *
+ */
+
+int main () {
+
+ const char ca[] = {'H', 'e', 'l', 'l', 'o'/*, '\0'*/};
+ const char *cp = ca;
+ while(*cp) {
+ std::cout << *cp << std::endl;
+ ++cp;
+ }
+ /*
+ * This causes a buffer overflow because there is no null character at the end of the string
+ * If we put a null-character at the end of the string we don't get an overflow.
+ */
+ return 0;
+}