Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

crash server #70

Open
plakapenka opened this issue Sep 8, 2022 · 1 comment
Open

crash server #70

plakapenka opened this issue Sep 8, 2022 · 1 comment

Comments

@plakapenka
Copy link

plakapenka commented Sep 8, 2022

incoming code

public OnIncomingPacket(playerid, packetid, BitStream:bs) 
{

	if(packetid == 251)
	{
		new header, rpcid;

		BS_ReadUint8(bs, header);
		BS_ReadUint8(bs, rpcid);

		if(rpcid == 41)
		{
			new _strlen, _authKey[65];
			BS_ReadUint32(bs, _strlen);
			BS_ReadString(bs, _authKey, _strlen);
		}
	}
}

send:

BitStream bs; 
            bs.Write((BYTE)251);
            bs.Write((uint8)41);
            bs.Write((uint32)64); 
            bs.Write((std::string)"asfrtrefdasf"); 
            SF->getRakNet()->SendPacket(&bs); 

crash:

[16:23:16] [debug] Server crashed while executing brilliant.amx
[16:23:16] [debug] AMX backtrace:
[16:23:16] [debug] #0 native BS_ReadValue () in pawnraknet.DLL
[16:23:16] [debug] #1 00034c14 in public OnIncomingPacket (playerid=0, packetid=251, BitStream:bs=1703132) at 

line crash

BS_ReadString(bs, _authKey, _strlen);
@plakapenka
Copy link
Author

If you replace BS_ReadUint32(bs, _strlen); with BS_ReadUint16(bs, _strlen); or 8 then it seems to work. But I would like to know the reason.
Maybe I'm an idiot

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant