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
Get step-by-step solutions from verified subject matter experts
