From 58425e978d4fa440fbf2015ac4cbbdb9fd0c900c Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 21 Jul 2019 09:01:17 +0200 Subject: osmocon: Add missing check for fstat() return value Change-Id: Ibef6ee00eb41e16d2ef52931f8c22562090cd1ee Closes: CID#198570 --- src/host/osmocon/osmocon.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c index 1bb0bb7d..61672a3f 100644 --- a/src/host/osmocon/osmocon.c +++ b/src/host/osmocon/osmocon.c @@ -287,6 +287,11 @@ int read_file(const char *filename, int chainload) } rc = fstat(fd, &st); + if (rc < 0) { + perror("fstat"); + close(fd); + return -EIO; + } if ((st.st_size > MAX_DNLOAD_SIZE) && (dnload.mode != MODE_ROMLOAD)) { fprintf(stderr, "The maximum file size is 64kBytes (%u bytes)\n", MAX_DNLOAD_SIZE); -- cgit v1.2.3