mirror of
https://github.com/deavminet/dnetd.git
synced 2025-02-20 06:27:05 +00:00
Fixed bug whereby DConnection thread would crash due to incorrect slicing indices
This commit is contained in:
parent
3716a6c583
commit
d18e6f4944
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user