-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhowToAttemptAccess.hpp
38 lines (29 loc) · 1.03 KB
/
howToAttemptAccess.hpp
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
27
28
29
30
31
32
33
34
35
36
37
38
// This belongs together with attempt_access.cpp and .exe
#include <string>
#include <sstream>
#include <iostream>
void call_attempt_access(int * ptr){
char command[10] = "";
strcat(command, "attempt_access.exe ");
std::stringstream ss;
ss << ptr;
std::string address = ss.str();
strcat(command, (address.c_str()));
int status = system(command); // gives a segmentation fault (returns -1073741819) if called with for example 0
if (status == -1073741819){
std::cout << "Segmentation fault. Invalid address.\n \n";
}
}
void call_attempt_access(std::string ptr){
char command[10] = "";
strcat(command, "attempt_access.exe ");
std::stringstream ss;
ss << ptr;
std::string address = ss.str();
strcat(command, (address.c_str()));
printf(command);
int status = system(command); // gives a segmentation fault (returns -1073741819) if called with for example 0
if (status == -1073741819){
std::cout << "Segmentation fault. Invalid address.\n \n";
}
}