blob: 968ce869a181835ba8d048cb0de7ee5db24b621b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
}
|