1234567891011121314151617 |
- Subject: Better error handling, found by coverity
- Origin: FILE5_34-16-g2f866ff0 <https://github.com/file/file/commit/FILE5_34-16-g2f866ff0>
- Upstream-Author: Christos Zoulas <christos@zoulas.com>
- Date: Wed Aug 1 10:02:20 2018 +0000
- --- a/src/readelf.c
- +++ b/src/readelf.c
- @@ -891,7 +891,8 @@
-
- offset = get_offset_from_virtaddr(ms, swap, clazz, fd, ph_off, ph_num,
- fsize, virtaddr);
- - if ((buflen = pread(fd, buf, CAST(size_t, buflen), offset)) <= 0) {
- + if (offset < 0 ||
- + (buflen = pread(fd, buf, CAST(size_t, buflen), offset)) <= 0) {
- file_badread(ms);
- return 0;
- }
|