From a51a3a63c8fe8eca1291bac6d5ca32b6690821e9 Mon Sep 17 00:00:00 2001 From: krypdkat <39078779+krypdkat@users.noreply.github.com> Date: Fri, 24 Jul 2026 11:01:36 +0700 Subject: [PATCH] fix oob bug in malformed header --- connection.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connection.cpp b/connection.cpp index 3096717..8b95493 100644 --- a/connection.cpp +++ b/connection.cpp @@ -180,6 +180,9 @@ int QubicConnection::receiveData(uint8_t* buffer, int sz) int QubicConnection::receiveAllDataOrThrowException(uint8_t* buffer, int sz) { + if (sz < 0 || sz > (int)sizeof(mBuffer)) { + throw std::logic_error("Invalid packet size."); + } int recvSz = receiveData(buffer, sz); if (recvSz != sz) {