我正在尝试自学C++中的缓冲区溢出和利用.我是一个中级C++家伙,充其量,所以请耐心等待.我已经按照一些教程,但这里有一些示例代码来说明我的问题:
#include <string>
#include <iostream>
using namespace std;
int main()
{
begin:
int authentication = 0;
char cUsername[10], cPassword[10];
char cUser[10], cPass[10];
cout << "Username: ";
cin >> cUser;
cout << "Pass: ";
cin >> cPass;
strcpy(cUsername, cUser);
strcpy(cPassword, cPass);
if(strcmp(cUsername, "admin") == 0 && strcmp(cPassword, "adminpass") == 0)
{
authentication = 1;
}
if(authentication)
{
cout << "Access granted\n";
cout << (char)authentication;
}
else
{
cout << "Wrong username and password\n";
}
system("pause");
goto begin;
}
Run Code Online (Sandbox Code Playgroud)
我知道有各种坏朱朱在这里cin << …