Fix #16327: Crash supplying a bad signature size in the auth packet

This commit is contained in:
ζeh Matt committed 2021-12-28 16:44:21 +02:00
1 parent 4155bf9ce0
commit b89eddc867
1 file changed
+9
+9
View File
@@ -2559,6 +2559,15 @@ void NetworkBase::Server_Handle_AUTH(NetworkConnection& connection, NetworkPacke
{
try
{
// RSA technically supports keys up to 65536 bits, so this is the
// maximum signature size for now.
constexpr auto MaxRSASignatureSizeInBytes = 8192;
if (sigsize == 0 || sigsize > MaxRSASignatureSizeInBytes)
{
throw std::runtime_error("Invalid signature size");
}
std::vector<uint8_t> signature;
signature.resize(sigsize);