pkcs5: Avoid NULL pointer dereference when verifying padding

Can be triggered via empty PKCS#7 encrypted content in IKEv1 CERT payload.

Fixes: 4076e3ee91 ("Extract PKCS#5 handling from pkcs8 plugin to separate helper class")
Fixes: CVE-2026-35329
This commit is contained in:
Tobias Brunner
2026-04-21 16:48:56 +02:00
parent 56c7f0d13d
commit 4da84019cc
+5
View File
@@ -113,6 +113,11 @@ static bool verify_padding(crypter_t *crypter, chunk_t *blob)
{
uint8_t padding, count;
if (!blob->len)
{
return FALSE;
}
padding = count = blob->ptr[blob->len - 1];
if (padding > crypter->get_block_size(crypter))