From fd25eaadfd5c7de8762571ecc5d74c29d4188969 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 22 Sep 2024 21:34:03 -0700 Subject: [PATCH] allow oversize commands in check_size_vec_t --- src/PSOProtocol.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PSOProtocol.hh b/src/PSOProtocol.hh index e95670e1..4e841d2a 100644 --- a/src/PSOProtocol.hh +++ b/src/PSOProtocol.hh @@ -121,9 +121,9 @@ T& check_size_t(void* data, size_t size) { } template -T* check_size_vec_t(std::string& data, size_t count) { +T* check_size_vec_t(std::string& data, size_t count, bool allow_extra = false) { size_t expected_size = count * sizeof(T); - return &check_size_generic(data.data(), data.size(), expected_size, expected_size); + return &check_size_generic(data.data(), data.size(), expected_size, allow_extra ? 0xFFFF : expected_size); } void check_size_v(size_t size, size_t min_size, size_t max_size = 0);