Skip to content
This repository has been archived by the owner on Nov 17, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed May 17, 2024
1 parent 1c60d6c commit 7c7fbd4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions LunaHook/engines/mono/monoil2cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ void commonsolvemonostring(uintptr_t offset,uintptr_t *data, size_t*len){
auto sw_v=sw.value();
*data=(uintptr_t)sw_v.data();
*len=sw_v.length()*sizeof(wchar_t);
//tostring|substring有时会会崩,非法指针或者长度爆炸
if(wcslen(sw_v.data())!=sw_v.size())
if(*len>TEXT_BUFFER_SIZE){
*len=0;
return;
}
}

void unity_ui_string_hook_after(uintptr_t *offset,void* data, size_t len)
Expand Down
4 changes: 2 additions & 2 deletions LunaHook/pchhook.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

enum { TEXT_BUFFER_SIZE = PIPE_BUFFER_SIZE - sizeof(TextOutput_T) };

#define wcslen(XX) wcsnlen((XX), TEXT_BUFFER_SIZE*2)
#define strlen(XX) strnlen((XX), TEXT_BUFFER_SIZE*2)
//#define wcslen(XX) wcsnlen((XX), TEXT_BUFFER_SIZE*2)
//#define strlen(XX) strnlen((XX), TEXT_BUFFER_SIZE*2)


#include"main.h"
Expand Down

0 comments on commit 7c7fbd4

Please sign in to comment.