From 24b2667ba3a309b9c710a1a0569b295cde929d9d Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sun, 10 Dec 2023 19:08:56 -0500 Subject: [PATCH] procaddr: add const --- hook/procaddr.c | 7 ++++--- hook/procaddr.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hook/procaddr.c b/hook/procaddr.c index 0d73e18..a9f2499 100644 --- a/hook/procaddr.c +++ b/hook/procaddr.c @@ -27,13 +27,14 @@ static const struct hook_symbol win32_hooks[] = { HRESULT proc_addr_table_push( HMODULE loader_mod, const char *target, - struct hook_symbol *syms, + const struct hook_symbol *syms, size_t nsyms ) { HRESULT hr; struct proc_addr_table *new_item; struct proc_addr_table *new_mem; + size_t target_len = strlen(target); proc_addr_hook_init(); @@ -53,9 +54,9 @@ HRESULT proc_addr_table_push( } new_item = &new_mem[proc_addr_hook_count]; - new_item->name = target; + strcpy_s(new_item->name, target_len, target); new_item->nsyms = nsyms; - new_item->syms = syms; + memcpy(new_item->syms, syms, sizeof(*syms)); proc_addr_hook_list = new_mem; proc_addr_hook_count++; diff --git a/hook/procaddr.h b/hook/procaddr.h index 4ec3967..5ef0a9a 100644 --- a/hook/procaddr.h +++ b/hook/procaddr.h @@ -14,7 +14,7 @@ struct proc_addr_table { HRESULT proc_addr_table_push( HMODULE loader_mod, const char *target, - struct hook_symbol *syms, + const struct hook_symbol *syms, size_t nsyms ); void proc_addr_insert_hooks(HMODULE target); \ No newline at end of file