diff options
author | Leandro Pereira <leandro@hardinfo.org> | 2014-04-28 20:44:14 -0300 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2014-05-14 20:17:30 -0300 |
commit | d36c886aed35491bf8e0e882eeae472f40f08eb7 (patch) | |
tree | 52e8f8282062627752c2fcb36dae3f6e2b912778 | |
parent | c48b269d64e4c2e23194f0a7c20d27e7727cdf3d (diff) | |
download | kmod-d36c886aed35491bf8e0e882eeae472f40f08eb7.tar.gz kmod-d36c886aed35491bf8e0e882eeae472f40f08eb7.tar.bz2 kmod-d36c886aed35491bf8e0e882eeae472f40f08eb7.zip |
Bail out of index_mm_open() if fstat() fails
-rw-r--r-- | libkmod/libkmod-index.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c index fa7db41..2136a96 100644 --- a/libkmod/libkmod-index.c +++ b/libkmod/libkmod-index.c @@ -800,7 +800,8 @@ struct index_mm *index_mm_open(struct kmod_ctx *ctx, const char *filename, goto fail_open; } - fstat(fd, &st); + if (fstat(fd, &st) < 0) + goto fail_nommap; if ((size_t) st.st_size < sizeof(hdr)) goto fail_nommap; |