|
|
楼主 |
发表于 2025-10-7 13:22:12
|
显示全部楼层
//-----------------------------------以下修复林纳斯的礼物--------------------------------
function fix_LinasGift() {
const Dispatcher_read = new NativeFunction(ptr(0x081db4c4), "int", ["pointer", "pointer", "pointer"], { abi: "sysv" });
const LineFunc = new NativeFunction(ptr(0x085908d7), "int", ["int", "pointer", "int", "uint"], { abi: "sysv" });
const PacketBuf_get_byte = new NativeFunction(ptr(0x0858cf70), "int", ["pointer", "pointer"], { abi: "sysv" });
Interceptor.replace(
Dispatcher_read,
new NativeCallback(
function (thisPtr, packetBuf, msgBase) {
const countPtr = msgBase.add(13);
// 读取计数值
const getByteResult = PacketBuf_get_byte(packetBuf, countPtr);
if (getByteResult !== 1) {
const msg = Memory.allocUtf8String("virtual int Dispatcher_Select_Item_Grwoth_Power::read(PacketBuf&, MSG_BASE&)");
return LineFunc(19029, msg, 0, 0);
}
const count = countPtr.readU8();
// 边界检查
const MAX_SAFE_COUNT = 5;
if (count > MAX_SAFE_COUNT) {
console.log("count>5,Buffer overflow prevented in Dispatcher_Select_Item_Grwoth_Power::read");
const msg = Memory.allocUtf8String("Buffer overflow prevented in Dispatcher_Select_Item_Grwoth_Power::read");
return LineFunc(19035, msg, 0, 0);
}
// 处理数据
for (let i = 0; i < count; i++) {
const target = msgBase.add(14 + i);
const byteResult = PacketBuf_get_byte(packetBuf, target);
if (byteResult !== 1) {
const msg = Memory.allocUtf8String("virtual int Dispatcher_Select_Item_Grwoth_Power::read(PacketBuf&, MSG_BASE&)");
return LineFunc(19034, msg, 0, 0);
}
}
return 0;
},
"int",
["pointer", "pointer", "pointer"]
)
);
}
//-----------------------------------以上修复林纳斯的礼物-------------------------------- |
|