Skip to content

Commit

Permalink
[BUGFIX] Fix ModuleData constructor (Issue #130)
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Oct 31, 2024
1 parent 745f6a2 commit 53c1915
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions scanners/module_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,21 @@ namespace pesieve {
class ModuleData {

public:
ModuleData(HANDLE _processHandle, HMODULE _module, bool _isPEBConnected, bool _useCache)
ModuleData(HANDLE _processHandle, HMODULE _module, bool _isPEBConnected, bool _useCache, const char* _moduleName = nullptr)
: processHandle(_processHandle), moduleHandle(_module),
isPEBConnected(_isPEBConnected), useCache(_useCache),
is_module_named(false), original_size(0), original_module(nullptr),
is_dot_net(false)
{
memset(szModName, 0, MAX_PATH);
loadModuleName();
}

ModuleData(HANDLE _processHandle, HMODULE _module, std::string module_name, bool _useCache)
: processHandle(_processHandle), moduleHandle(_module), useCache(_useCache),
is_module_named(false), original_size(0), original_module(nullptr),
is_dot_net(false)
{
memset(szModName, 0, MAX_PATH);
memcpy(this->szModName, module_name.c_str(), module_name.length());
if (!_moduleName) {
loadModuleName();
}
else {
const size_t nameLen = strnlen(_moduleName, MAX_PATH);
memcpy(this->szModName, _moduleName, nameLen);
}

}

~ModuleData()
Expand Down
2 changes: 1 addition & 1 deletion scanners/workingset_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ bool pesieve::WorkingSetScanner::scanImg(MemPageData& memPage)
}

//load module from file:
ModuleData modData(processHandle, module_start, memPage.mapped_name, args.use_cache);
ModuleData modData(processHandle, module_start, true, args.use_cache, memPage.mapped_name.c_str());
if (!modData.loadOriginal()) {
if (!args.quiet) {
std::cerr << "[-] [" << std::hex << modData.moduleHandle << "] Could not read the module file" << std::endl;
Expand Down

0 comments on commit 53c1915

Please sign in to comment.