浏览代码

Fix null deref + reduce WIN32 API reqs

nosoop 3 年之前
父节点
当前提交
310179134b
共有 2 个文件被更改,包括 2 次插入1 次删除
  1. 1 1
      memscan.cpp
  2. 1 0
      memscan.h

+ 1 - 1
memscan.cpp

@@ -94,7 +94,7 @@ bool CLinuxLibInfo::LocateSymbol(const char* name, void** result) {
 		gelf_getsym(data, i, &sym);
 		
 		const char *symname = elf_strptr(this->m_Elf, shdr.sh_link, sym.st_name);
-		if (!strcmp(symname, name)) {
+		if (symname && !strcmp(symname, name)) {
 			*result = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(m_info.dli_fbase) + sym.st_value);
 			return true;
 		}

+ 1 - 0
memscan.h

@@ -5,6 +5,7 @@
 #include <cstdint>
 
 #if WINDOWS
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #elif _LINUX
 #include "mmsplugin.h"