From d36c886aed35491bf8e0e882eeae472f40f08eb7 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Mon, 28 Apr 2014 20:44:14 -0300 Subject: [PATCH] Bail out of index_mm_open() if fstat() fails --- libkmod/libkmod-index.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.7.4