Skip to content

Instantly share code, notes, and snippets.

@mesaleh
Last active August 29, 2015 14:14
Show Gist options
  • Save mesaleh/86454cf3f2dda19d166f to your computer and use it in GitHub Desktop.
Save mesaleh/86454cf3f2dda19d166f to your computer and use it in GitHub Desktop.
Used for my blog entry to describe PEiD vulnerability
// getting the exact size of the section
int getMinSectionSize()
{
int size = min(VirtualSize, SizeOfRawData)
// ** if PointerToRawData is negative, overflow will happen here.
int bound = file_size - PointerToRawData
if (size <= bound) return size;
else size = bound;
return size;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment