1
0
mirror of https://github.com/deavminet/dnetd synced 2024-09-21 01:33:24 +02:00

Fixed bug whereby DConnection thread would crash due to incorrect slicing indices

This commit is contained in:
Tristan B. Kildaire 2020-09-25 01:08:28 +02:00
parent 3716a6c583
commit d18e6f4944

View File

@ -169,7 +169,7 @@ public class DConnection : Thread
byte usernameLength = message.data[1];
/* Get the username and password */
string username = cast(string)message.data[2..usernameLength];
string username = cast(string)message.data[2..cast(ulong)2+usernameLength];
string password = cast(string)message.data[cast(ulong)2+usernameLength..message.data.length];
/* Authenticate */
@ -182,6 +182,7 @@ public class DConnection : Thread
/* Set the type of this connection to `client` */
connType = ConnectionType.CLIENT;
hasAuthed = true;
/* Encode the reply */
byte[] reply = [status];