diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2015-02-10 10:46:26 -0200 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2015-02-10 10:46:26 -0200 |
commit | 6684102cd3c371c2c977ffffe8859e93f909c680 (patch) | |
tree | 223545f2a1e295d13ace52e8250e218422f8bc27 | |
parent | aac5f4514f71d04ac3dcb8b923209781895d7ff2 (diff) | |
download | kmod-6684102cd3c371c2c977ffffe8859e93f909c680.tar.gz |
libkmod: use helper function to check for overflow
-rw-r--r-- | libkmod/libkmod-elf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c index 8a8a73d..4af829e 100644 --- a/libkmod/libkmod-elf.c +++ b/libkmod/libkmod-elf.c @@ -250,8 +250,8 @@ static inline int elf_get_section_info(const struct kmod_elf *elf, uint16_t idx, } #undef READV - min_size = *offset + *size; - if (ULLONG_MAX - *offset < *size || min_size > elf->size) { + if (addu64_overflow(*offset, *size, &min_size) + || min_size > elf->size) { ELFDBG(elf, "out-of-bounds: %"PRIu64" >= %"PRIu64" (ELF size)\n", min_size, elf->size); return -EINVAL; |