mirror of
https://github.com/netbirdio/IronRDP.git
synced 2026-05-22 18:43:12 -07:00
fix(pdu): overflow when decoding RsaPublicKey (#409)
This commit is contained in:
@@ -217,6 +217,8 @@ pub enum ServerLicenseError {
|
||||
InvalidRsaPublicKeyLength,
|
||||
#[error("invalid RSA public key data length")]
|
||||
InvalidRsaPublicKeyDataLength,
|
||||
#[error("invalid RSA public key bit length")]
|
||||
InvalidRsaPublicKeyBitLength,
|
||||
#[error("invalid License Header security flags")]
|
||||
InvalidSecurityFlags,
|
||||
#[error("the server returned unexpected error: {0:?}")]
|
||||
|
||||
@@ -160,6 +160,10 @@ impl PduParsing for RsaPublicKey {
|
||||
return Err(ServerLicenseError::InvalidRsaPublicKeyLength);
|
||||
}
|
||||
|
||||
if bitlen < 8 {
|
||||
return Err(ServerLicenseError::InvalidRsaPublicKeyBitLength);
|
||||
}
|
||||
|
||||
let datalen = stream.read_u32::<LittleEndian>()?;
|
||||
if datalen != (bitlen / 8) - 1 {
|
||||
return Err(ServerLicenseError::InvalidRsaPublicKeyDataLength);
|
||||
|
||||
Reference in New Issue
Block a user