Importing fgets()

Before we begin the implementation of our patch, we still need to make the executable import fgets() instead of gets(). This appears to be quite easy. Let's take a look at the content of the import table where the gets() function is imported:

Having located the string, we may safely overwrite it with fgets. The explanation, looking at the following screenshot, makes it clear why such overwriting is safe in this specific case:

The preceding screenshot shows gets being replaced by fgets already. We are lucky once more here because the gets string, which started at the file offset 0x7EF0, did not end on an even boundary, so we had an extra zero at 0x7EF5, thus leaving us enough space to overwrite gets with fgets and have the terminating NULL intact.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset