Skip to content

Commit

Permalink
api hooks: add support for msvcrt.memmove
Browse files Browse the repository at this point in the history
closes #262.
  • Loading branch information
williballenthin committed Mar 15, 2017
1 parent 4fd1450 commit 2d78a44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions floss/api_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,16 @@ def hook(self, callname, driver, callconv, api, argv):

class MemcpyHook(viv_utils.emulator_drivers.Hook):
'''
Hook and handle calls to memcpy.
Hook and handle calls to memcpy and memmove.
'''
MAX_COPY_SIZE = 1024 * 1024 * 32 # don't attempt to copy more than 32MB, or something is wrong

def __init__(self, *args, **kwargs):
super(MemcpyHook, self).__init__(*args, **kwargs)

def hook(self, callname, driver, callconv, api, argv):
if callname == "msvcrt.memcpy":
if callname == "msvcrt.memcpy" or \
callname == "msvcrt.memmove":
emu = driver
dst, src, count = argv
if count > self.MAX_COPY_SIZE:
Expand Down
1 change: 1 addition & 0 deletions floss/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

from utils import get_vivisect_meta_info


floss_logger = logging.getLogger("floss")


Expand Down

0 comments on commit 2d78a44

Please sign in to comment.