From 015cbd8cd727395256d66aed0367ad9d454656ff Mon Sep 17 00:00:00 2001 From: Niklaas Wriedt Date: Sat, 9 Mar 2024 20:23:44 +0100 Subject: [PATCH] fix formatting --- RyuSocks/Packets/Auth/Constants.cs | 16 ++++++++++++++++ .../UsernameAndPasswordRequest.cs | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/RyuSocks/Packets/Auth/Constants.cs b/RyuSocks/Packets/Auth/Constants.cs index 0da6b95..36de771 100644 --- a/RyuSocks/Packets/Auth/Constants.cs +++ b/RyuSocks/Packets/Auth/Constants.cs @@ -1,3 +1,19 @@ +/* + * Copyright (C) RyuSOCKS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + namespace RyuSocks.Packets.Auth { public static class Constants diff --git a/RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordRequest.cs b/RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordRequest.cs index 5e26920..b2ddd2a 100644 --- a/RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordRequest.cs +++ b/RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordRequest.cs @@ -23,7 +23,6 @@ namespace RyuSocks.Packets.Auth.UsernameAndPassword { public class UsernameAndPasswordRequest : Packet { - public byte Version { get @@ -56,6 +55,8 @@ public string Username } set { + ArgumentOutOfRangeException.ThrowIfGreaterThan(value.Length, 0xFF); + UsernameLength = (byte)value.Length; Encoding.ASCII.GetBytes(value).CopyTo(Bytes.AsSpan(2, UsernameLength)); } }