Published on October 14th, 2019 📆 | 4768 Views ⚑
0Computer Security: Buffer Overflows
iSpeech
A short educational video about buffer overflows. A mixture of some theory and a bit of practical elements. (The video is part of an assignment for a Computer Security module)
======================= Code =======================
(Just find and replace all [ ] with angled brackets / less than and greater than signs, since youtube doesn't allow those in the description.)
#include [iostream]
#include [cstdlib]
#include [cstring]
using namespace std;
int main(){
char *buff1 = (char *)malloc(16 * sizeof(char));
char *buff2 = (char *)malloc(16 * sizeof(char));
printf("buff1 address: %pn", buff1);
printf("buff2 address: %pn", buff2);
strcpy(buff2, "insanepassword");
cout [[ "Please enter your password: ";
string password; cin ]] password;
strcpy(buff1, password.data());
printf("buff1: %sn", buff1);
printf("buff2: %sn", buff2);
int cmp = strncmp(buff1, buff2, 16);
if(cmp == 0){
printf("Logged In.");
}
else {
printf("Incorrect Password.");
}
free(buff1);
free(buff2);
}
video, sharing, camera phone, video phone, free, upload
2019-10-14 17:35:25
source
Gloss