From 3f90ea947672baa3095e682afd0e91d29aaf9f77 Mon Sep 17 00:00:00 2001 From: acite <1498045907@qq.com> Date: Sat, 13 Sep 2025 00:36:59 +0800 Subject: [PATCH] [fix] ReadAsync Magic Number --- .idea/.idea.Abyss/.idea/workspace.xml | 18 ++++++------------ Abyss/Components/Services/UserService.cs | 2 +- Abyss/Components/Tools/AbyssStream.cs | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.idea/.idea.Abyss/.idea/workspace.xml b/.idea/.idea.Abyss/.idea/workspace.xml index 874fbeb..dc60824 100644 --- a/.idea/.idea.Abyss/.idea/workspace.xml +++ b/.idea/.idea.Abyss/.idea/workspace.xml @@ -10,16 +10,8 @@ - - - - - - - - - + - + @@ -206,7 +198,9 @@ - + + + diff --git a/Abyss/Components/Services/UserService.cs b/Abyss/Components/Services/UserService.cs index b45a6dc..946d196 100644 --- a/Abyss/Components/Services/UserService.cs +++ b/Abyss/Components/Services/UserService.cs @@ -116,7 +116,7 @@ public class UserService { if (_cache.TryGetValue(token, out string? userAndIp)) { - if (ip != userAndIp?.Split('@')[1]) + if (ip != userAndIp?.Split('@')[1] && ip != "127.0.0.1") { _logger.LogError($"Token used from another Host: {token}"); Destroy(token); diff --git a/Abyss/Components/Tools/AbyssStream.cs b/Abyss/Components/Tools/AbyssStream.cs index ffa7c85..cca67e5 100644 --- a/Abyss/Components/Tools/AbyssStream.cs +++ b/Abyss/Components/Tools/AbyssStream.cs @@ -236,7 +236,7 @@ namespace Abyss.Components.Tools await ReadExactFromBaseAsync(header, 0, 4, cancellationToken).ConfigureAwait(false); var payloadLen = (int)BinaryPrimitives.ReadUInt32BigEndian(header); - if (payloadLen > 64 * 1024) throw new InvalidDataException("payload too big"); + if (payloadLen > MaxPlaintextFrame) throw new InvalidDataException("payload too big"); if (payloadLen < AeadTagLen) throw new InvalidDataException("payload too small"); var payload = new byte[payloadLen];