pkcs7: Avoid NULL pointer dereference when verifying padding in enveloped content
As the previous issue, this can be triggered via IKEv1 CERT payloads.
Fixes: d7aa09104f ("Implement PKCS#7 enveloped-data parsing and decryption")
Fixes: CVE-2026-35329
This commit is contained in:
@@ -182,9 +182,17 @@ static bool decrypt(private_key_t *private, chunk_t key, chunk_t iv, int oid,
|
|||||||
*/
|
*/
|
||||||
static bool remove_padding(private_pkcs7_enveloped_data_t *this)
|
static bool remove_padding(private_pkcs7_enveloped_data_t *this)
|
||||||
{
|
{
|
||||||
u_char *pos = this->content.ptr + this->content.len - 1;
|
u_char *pos, pattern;
|
||||||
u_char pattern = *pos;
|
size_t padding;
|
||||||
size_t padding = pattern;
|
|
||||||
|
if (!this->content.len)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pos = this->content.ptr + this->content.len - 1;
|
||||||
|
pattern = *pos;
|
||||||
|
padding = pattern;
|
||||||
|
|
||||||
if (padding > this->content.len)
|
if (padding > this->content.len)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user