How it works...
To enter the name and order number of a customer, define a structure called users with two members, name and orderid. The name member is a character array or string of 10 bytes in length, and the orderid member is a variable of the int data type consisting of 2 bytes.
A variable, user1, is defined as the users structure type; hence, the user1 structure will get two members, name and orderid. An integer value 101 is assigned to the orderid member of user1 structure. Also, a string, administrator, is assigned to the name member of user1. Because the string administrator is larger than the size of the name member, a buffer overflow will occur, overwriting the memory of the next memory location, that is, of the orderid member. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access