diff options
author | Zeex <zeex@rocketmail.com> | 2020-11-01 12:39:32 +0600 |
---|---|---|
committer | Zeex <zeex@rocketmail.com> | 2020-11-01 12:39:32 +0600 |
commit | 89f9730f2b90e12b52fb59589e02400999643b8c (patch) | |
tree | fbfbbdd2663327a8422557f0c16b4e40e2c7e84c | |
parent | 0a60c318843fa88a94adb50acf457f17a05aff25 (diff) | |
download | subhook-89f9730f2b90e12b52fb59589e02400999643b8c.zip subhook-89f9730f2b90e12b52fb59589e02400999643b8c.tar.gz subhook-89f9730f2b90e12b52fb59589e02400999643b8c.tar.bz2 |
Fix possible NULL dereference
-rw-r--r-- | subhook_x86.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/subhook_x86.c b/subhook_x86.c index a6eb8bb..6256ebb 100644 --- a/subhook_x86.c +++ b/subhook_x86.c @@ -458,18 +458,16 @@ SUBHOOK_EXPORT subhook_t SUBHOOK_API subhook_new(void *src, subhook_t hook; int result; - hook = malloc(sizeof(*hook)); + hook = calloc(1, sizeof(*hook)); if (hook == NULL) { return NULL; } - hook->installed = 0; hook->src = src; hook->dst = dst; hook->flags = flags; hook->jmp_size = subhook_get_jmp_size(hook->flags); hook->trampoline_size = hook->jmp_size * 2 + MAX_INSN_LEN; - hook->trampoline_len = 0; hook->code = malloc(hook->jmp_size); if (hook->code == NULL) { |