]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Correctly compute public key exponent length when larger than 255. 16810/head
authorMiod Vallat <miod.vallat@powerdns.com>
Wed, 4 Feb 2026 06:00:16 +0000 (07:00 +0100)
committerMiod Vallat <miod.vallat@powerdns.com>
Wed, 4 Feb 2026 06:30:30 +0000 (07:30 +0100)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/opensslsigners.cc

index 3a8df543b169c47c345fae338129398ff86d7d6e..fb4daf6aec7c759ba5c94e0d720b99fbd1c37362 100644 (file)
@@ -941,7 +941,7 @@ void OpenSSLRSADNSCryptoKeyEngine::fromPublicKeyString(const std::string& conten
     if (contentLen < 3) {
       throw runtime_error(getName() + " invalid input size for the public key");
     }
-    const size_t exponentSize = raw[1] * 0xff + raw[2];
+    const size_t exponentSize = (static_cast<size_t>(raw[1])) * 0x100 + raw[2];
     if (contentLen < (exponentSize + 4)) {
       throw runtime_error(getName() + " invalid input size for the public key");
     }