Browse Source

Fix null deref + reduce WIN32 API reqs

nosoop 4 years ago
parent
commit
310179134b
2 changed files with 2 additions and 1 deletions
  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"