Skip to content

Commit bfc8f30

Browse files
Razvan CojocaruJenkins-dev
authored andcommitted
Make sure plaintext.max_size() > 2 + serverkey_id_size always
Address Coverity complaint. Signed-off-by: Razvan Cojocaru <[email protected]>
1 parent 969c790 commit bfc8f30

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

openvpn/ssl/proto.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,6 +2470,9 @@ class ProtoContext : public logging::LoggingMixin<OPENVPN_DEBUG_PROTO,
24702470
plaintext.write(&k_id, sizeof(k_id));
24712471
}
24722472

2473+
if (plaintext.max_size() <= 2 + serverkey_id_size)
2474+
return Error::DECRYPT_ERROR;
2475+
24732476
const size_t decrypt_bytes = tls_crypt_server.decrypt(wkc_raw,
24742477
plaintext.data() + 2 + serverkey_id_size,
24752478
plaintext.max_size() - 2 - serverkey_id_size,

0 commit comments

Comments
 (0)