mirror of
https://github.com/AuxXxilium/kmod.git
synced 2024-12-19 13:08:25 +07:00
libkmod: consider empty signature key as invalid
A segmentation fault occurs if a module has an empty key attached to its signature. This is mostly likely due to a corrupted module. The crash happens because kmod_module_get_info() assumes that kmod_module_signature_info() returns a signature of at least 1 byte. The fix is based on a patch from Tobias Stoeckmann <tobias@stoeckmann.org>, but rather than changing kmod_module_get_info() to fix the crash, this changes kmod_module_signature_info() to consider the signature as invalid.
This commit is contained in:
parent
40ef6e69bb
commit
dcbe1846e8
@ -124,7 +124,8 @@ bool kmod_module_signature_info(const struct kmod_file *file, struct kmod_signat
|
||||
modsig->id_type >= PKEY_ID_TYPE__LAST)
|
||||
return false;
|
||||
sig_len = be32toh(get_unaligned(&modsig->sig_len));
|
||||
if (size < (int64_t)(modsig->signer_len + modsig->key_id_len + sig_len))
|
||||
if (sig_len == 0 ||
|
||||
size < (int64_t)(modsig->signer_len + modsig->key_id_len + sig_len))
|
||||
return false;
|
||||
|
||||
size -= modsig->key_id_len + sig_len;
|
||||
|
Loading…
Reference in New Issue
Block a user