mirror of
https://github.com/AuxXxilium/kmod.git
synced 2024-12-20 05:27:54 +07:00
libkmod: Fix unaligned access
From Jan Engelhardt: Program received signal SIGBUS, Bus error. [Switching to process 11100] 0x00035278 in kmod_module_signature_info (file=0x4eeb8, sig_info=0xffffc254) at libkmod/libkmod-signature.c:124 124 sig_len = be32toh(modsig->sig_len); (gdb) p modsig $1 = (const struct module_signature *) 0xf7dfe143 modsig->sig_len can be unaligned if modsig is unaligned, so the padding in the struct has no effect since we are mapping it to the mem buffer.
This commit is contained in:
parent
6d59d9d086
commit
f87dc57a71
@ -121,7 +121,7 @@ bool kmod_module_signature_info(const struct kmod_file *file, struct kmod_signat
|
||||
modsig->hash >= PKEY_HASH__LAST ||
|
||||
modsig->id_type >= PKEY_ID_TYPE__LAST)
|
||||
return false;
|
||||
sig_len = be32toh(modsig->sig_len);
|
||||
sig_len = be32toh(get_unaligned(&modsig->sig_len));
|
||||
if (size < (off_t)(modsig->signer_len + modsig->key_id_len + sig_len))
|
||||
return false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user