Help! Calling hooked function with string arg crashes game

fshn06

Platinian
Game: Growtopia
Native c++ game , armeabi-v7a

I am hooking the SendPacket symbol, everything is fine until I call SendPacket

SendPacket(int type, std::string& text, ENetPeer* peer)

C++:
void oSendPacket(int, std::string&, ENetPeer*);
void hkSendPacket(int type, std::string& text, ENetPeer* peer) {
    oSendPacket(type, text, peer);
}

C++:
std::string packet = "action|log\nmsg|test";
oSendPacket(3, packet, GetPeer());

All other hooks without string param have no issues

Crash Report
Screenshot_2024-01-31-19-36-26-201_com.miui.bugreport.jpg
 
Try changing the function signature
SendPacket(int type, std::string* text, ENetPeer* peer)

And then you call it like
std::string packet = "action|log\nmsg|test"; oSendPacket(3, &packet, GetPeer());
 
Back
Top Bottom