This commit is contained in:
恍兮惚兮 2024-05-17 17:34:20 +08:00
parent 1c60d6c4cc
commit 7c7fbd45c7
2 changed files with 5 additions and 4 deletions

View File

@ -26,9 +26,10 @@ void commonsolvemonostring(uintptr_t offset,uintptr_t *data, size_t*len){
auto sw_v=sw.value(); auto sw_v=sw.value();
*data=(uintptr_t)sw_v.data(); *data=(uintptr_t)sw_v.data();
*len=sw_v.length()*sizeof(wchar_t); *len=sw_v.length()*sizeof(wchar_t);
//tostring|substring有时会会崩非法指针或者长度爆炸 if(*len>TEXT_BUFFER_SIZE){
if(wcslen(sw_v.data())!=sw_v.size())
*len=0; *len=0;
return;
}
} }
void unity_ui_string_hook_after(uintptr_t *offset,void* data, size_t len) void unity_ui_string_hook_after(uintptr_t *offset,void* data, size_t len)

View File

@ -2,8 +2,8 @@
enum { TEXT_BUFFER_SIZE = PIPE_BUFFER_SIZE - sizeof(TextOutput_T) }; enum { TEXT_BUFFER_SIZE = PIPE_BUFFER_SIZE - sizeof(TextOutput_T) };
#define wcslen(XX) wcsnlen((XX), TEXT_BUFFER_SIZE*2) //#define wcslen(XX) wcsnlen((XX), TEXT_BUFFER_SIZE*2)
#define strlen(XX) strnlen((XX), TEXT_BUFFER_SIZE*2) //#define strlen(XX) strnlen((XX), TEXT_BUFFER_SIZE*2)
#include"main.h" #include"main.h"