]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Fix] Fix union handling in ED25519 key loading to prevent memory corruption 5664/head
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 4 Oct 2025 14:48:05 +0000 (15:48 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 4 Oct 2025 14:48:05 +0000 (15:48 +0100)
commite98518703762eabeffc0326bca02d44b15041d0b
tree02befbe156d10090c17bb019950f674899a5415c
parent9e45beec7cd3bff905ba207a8b4e2a4ff5f22ca7
[Fix] Fix union handling in ED25519 key loading to prevent memory corruption

When loading ED25519 keys from PEM, the code was writing to key_eddsa in the
union and then attempting to free key_ssl pointers, which corrupted the
key_eddsa pointer and caused use-after-free/double-free during cleanup.

The fix saves the EVP_PKEY and BIO pointers to temporary variables, extracts
the raw key, frees the OpenSSL objects, and only then assigns to the union.
This prevents memory corruption and resource leaks.
src/libserver/dkim.c