summaryrefslogtreecommitdiffstats
path: root/src/host/osmocon
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-07-21 09:01:17 +0200
committerHarald Welte <laforge@gnumonks.org>2019-07-21 09:01:17 +0200
commit58425e978d4fa440fbf2015ac4cbbdb9fd0c900c (patch)
treee909941ef098b8210f34c7409410eb11b0d3403a /src/host/osmocon
parent6b9df297dc9124c90ae40d231b3b1cab0f3ed916 (diff)
osmocon: Add missing check for fstat() return value
Change-Id: Ibef6ee00eb41e16d2ef52931f8c22562090cd1ee Closes: CID#198570
Diffstat (limited to 'src/host/osmocon')
-rw-r--r--src/host/osmocon/osmocon.c5
1 files changed, 5 insertions, 0 deletions
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);