Adding INSN hook checks for x86 (#833)

* adding INSN hook checking for x86

* tabs to spaces

* need to return bool not uc_err

* fixed conditional after switching to bool
This commit is contained in:
bulaza
2017-05-13 13:16:17 -04:00
committed by Nguyen Anh Quynh
parent 4b50ca5cec
commit 4b9efdc986
3 changed files with 25 additions and 1 deletions

7
uc.c
View File

@ -1036,6 +1036,13 @@ uc_err uc_hook_add(uc_engine *uc, uc_hook *hh, int type, void *callback,
hook->insn = va_arg(valist, int);
va_end(valist);
if (uc->insn_hook_validate) {
if (! uc->insn_hook_validate(hook->insn)) {
free(hook);
return UC_ERR_HOOK;
}
}
if (list_append(&uc->hook[UC_HOOK_INSN_IDX], hook) == NULL) {
free(hook);
return UC_ERR_NOMEM;