From 6b29a697b9879c03146cca24bb30c64d25810cb8 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 25 Oct 2013 21:28:58 +0100 Subject: check ftell return value coverity 1109870 --- utils/container.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'utils/container.c') diff --git a/utils/container.c b/utils/container.c index 26d4745a0..97f1d7eaf 100644 --- a/utils/container.c +++ b/utils/container.c @@ -80,11 +80,18 @@ struct container_ctx { inline static size_t container_filelen(FILE *fd) { - long o = ftell(fd); + long o; long a; + o = ftell(fd); + if (o == -1) { + LOG(("Could not get current stream position")); + return 0; + } + fseek(fd, 0, SEEK_END); a = ftell(fd); + fseek(fd, o, SEEK_SET); if (a == -1) { LOG(("could not ascertain size of file in theme container; omitting")); -- cgit v1.2.3