summaryrefslogtreecommitdiff
path: root/libkmod
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2015-02-15 00:35:47 +0100
committerLucas De Marchi <lucas.demarchi@intel.com>2015-02-18 15:49:10 -0200
commit40ef6e69bb13522b961767d81f44aec0e83a7462 (patch)
tree5a5a66fe84547b1394f59a343381abd488a69162 /libkmod
parent249dc5909b09db72cc8958b382d8393235b70afd (diff)
downloadkmod-40ef6e69bb13522b961767d81f44aec0e83a7462.tar.gz
kmod-40ef6e69bb13522b961767d81f44aec0e83a7462.tar.bz2
kmod-40ef6e69bb13522b961767d81f44aec0e83a7462.zip
Fix out of bounds signature access with 32 bit off_t
If kmod has been configured with --disable-largefile on a 32 bit system, off_t will be 32 bit. In that case, the parsed sig_len can bypass a validation check (it's _unsigned_ 32 bit). Due to the unlikeliness of people using --disable-largefile, this is a mere validation fix. With an explicit signed 64 bit cast, there is no binary change for 99.9% of Linux systems out there. ;)
Diffstat (limited to 'libkmod')
-rw-r--r--libkmod/libkmod-signature.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
index 5ed5973..2260cc6 100644
--- a/libkmod/libkmod-signature.c
+++ b/libkmod/libkmod-signature.c
@@ -124,7 +124,7 @@ 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 < (off_t)(modsig->signer_len + modsig->key_id_len + sig_len))
+ if (size < (int64_t)(modsig->signer_len + modsig->key_id_len + sig_len))
return false;
size -= modsig->key_id_len + sig_len;