Skip to content

Commit

Permalink
Misc fixes (tklengyel#1206)
Browse files Browse the repository at this point in the history
* Add explicit 'no' to libhooktest in configure.ac

* Zero-init class-member traps in plugins
  • Loading branch information
tklengyel authored Apr 15, 2021
1 parent fc6ecab commit f42bfd6
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ AC_ARG_ENABLE([plugin_libhooktest],
[AS_HELP_STRING([--enable-plugin-libhooktest],
[Enable libhooktest plugin for testing @<:@no@:>@])],
[plugin_libhooktest="$enableval"],
[plugin_libhooktest=""])
[plugin_libhooktest="no"])
AM_CONDITIONAL([PLUGIN_LIBHOOKTEST], [test x$plugin_libhooktest = xyes])
if test x$plugin_libhooktest = xyes; then
AC_DEFINE_UNQUOTED(ENABLE_PLUGIN_LIBHOOKTEST, 1, "")
Expand Down
2 changes: 1 addition & 1 deletion src/libhook/hooks/return.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ auto ReturnHook::create(drakvuf_t drakvuf, drakvuf_trap_info* info, cb_wrapper_t

// not using std::make_unique because ctor is private
auto hook = std::unique_ptr<ReturnHook>(new ReturnHook(drakvuf, cb));
hook->trap_ = new drakvuf_trap_t;
hook->trap_ = new drakvuf_trap_t();

auto ret_addr = drakvuf_get_function_return_address(drakvuf, info);
if (!ret_addr)
Expand Down
2 changes: 1 addition & 1 deletion src/libhook/hooks/syscall.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ auto SyscallHook::create(drakvuf_t drakvuf, const std::string& syscall_name, cb_

// not using std::make_unique because ctor is private
auto hook = std::unique_ptr<SyscallHook>(new SyscallHook(drakvuf, syscall_name, cb));
hook->trap_ = new drakvuf_trap_t;
hook->trap_ = new drakvuf_trap_t();

if (!drakvuf_get_kernel_symbol_rva(hook->drakvuf_, hook->syscall_name_.c_str(), &hook->trap_->breakpoint.rva))
{
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/cpuidmon/cpuidmon.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class cpuidmon: public plugin
{
public:
output_format_t format;
drakvuf_trap_t cpuid;
drakvuf_trap_t cpuid{};
drakvuf_t drakvuf;
bool stealth;

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/debugmon/debugmon.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class debugmon: public plugin
{
public:
output_format_t format;
drakvuf_trap_t debug;
drakvuf_trap_t debug{};
drakvuf_t drakvuf;

debugmon(drakvuf_t drakvuf, output_format_t output);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/exploitmon/exploitmon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static bool hook_page(
event_response_t (*callback)(drakvuf_t, drakvuf_trap_info_t*),
addr_t data = 0)
{
auto trap = new drakvuf_trap_t;
auto trap = new drakvuf_trap_t();
if (!trap)
return false;

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/plugins_ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ drakvuf_trap_t* pluginex::register_trap(drakvuf_trap_info_t* info,
int64_t ttl,
ah_cb_t ah_cb)
{
auto trap = new drakvuf_trap_t;
auto trap = new drakvuf_trap_t();

if constexpr (std::is_same_v<Params, void>)
{
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/poolmon/poolmon.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class poolmon: public plugin
public:
output_format_t format;
GTree* pooltag_tree;
drakvuf_trap_t trap;
drakvuf_trap_t trap{};

poolmon(drakvuf_t drakvuf, output_format_t output);
~poolmon();
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/ssdtmon/ssdtmon.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class ssdtmon: public plugin
{
public:
output_format_t format;
drakvuf_trap_t ssdtwrite;
drakvuf_trap_t ssdtwrite2;
drakvuf_trap_t ssdtwrite{};
drakvuf_trap_t ssdtwrite2{};

addr_t kiservicetable;
uint32_t kiservicelimit;
Expand Down

0 comments on commit f42bfd6

Please sign in to comment.