buffer overflow - C++ code exploit -
i learning basic buffer overflow issues, can please explain how code can exploited.
char gwelcome [] = "welcome our system! "; void echo (int fd) { int len; char name [64], reply [128]; len = strlen (gwelcome); memcpy (reply, gwelcome, len); /* copy welcome string reply */ write_to_socket (fd, "type name: "); /* prompt client name */ read (fd, name, 128); /* read name socket */ /* copy name reply buffer (starting @ offet len, * won't overwrite welcome message copied earlier). */ memcpy (reply+len, name, 64); write (fd, reply, len + 64); return; } void server (int socketfd) { while (1) echo (socketfd); }
Comments
Post a Comment