Permalink
Browse files

Fix GDC's Linux sigscanning (#576)

The pointer returned by dlopen is not inside the loaded librarys memory region.
1 parent a0f060f commit 3fd7b29d64e286d3c9cb7c9de0c725d29873e301 @GoD-Tony GoD-Tony committed with psychonic Jan 20, 2017
Showing with 5 additions and 1 deletion.
  1. +5 −1 tools/gdc-psyfork/gdc.cpp
@@ -4,6 +4,7 @@
#include <fcntl.h>
#include <math.h>
#include <iostream>
+#include <link.h>
#include "gdc.h"
#include "GameConfigs.h"
#include "MemoryUtils.h"
@@ -619,7 +620,10 @@ int checkSigStringL(void *handle, const char* symbol)
if (real_bytes >= 1)
{
- mu.FindPattern(handle, (char*)real_sig, real_bytes, matches, dummy);
+ // The pointer returned by dlopen is not inside the loaded librarys memory region.
+ struct link_map *dlmap = (struct link_map *)handle;
+
+ mu.FindPattern((void *)dlmap->l_addr, (char*)real_sig, real_bytes, matches, dummy);
}
}

0 comments on commit 3fd7b29

Please sign in to comment.