Question
can you please identify two vulnerabilities and explain how they could be exploited by an attacker. Please use a diagram to explain the attack mechanism.
can you please identify two vulnerabilities and explain how they could be exploited by an attacker. Please use a diagram to explain the attack mechanism. I believe it is vulnerable to buffer overflow but im not 100% sure. Then can you please demonstrate code improvements that. could be used to prevent the attack, please include the source code that would be used to illustrate the improvements. Code is in C.
class employee{ public: char name[10]; char address[10]; ... void setName(char* nm){ strcpy(name, nm); } void getName(char** nm){ strcpy(*nm,name); } void setAddress(char* adr){ strcpy(address, adr); } void getAddress(char** adr){ strcpy(*adr,address); } }; int main() { employee emp; char p[10]; ... emp.setName(p); ... emp.getName((char**)&nm); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started