summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2013-10-25 21:28:58 +0100
committerVincent Sanders <vince@netsurf-browser.org>2013-10-25 21:28:58 +0100
commit6b29a697b9879c03146cca24bb30c64d25810cb8 (patch)
tree8464cba24b2e9f5f94b1045abf4977c1f0214317
parentf29306cc9aae8365ab52418c589700c0f448fbd4 (diff)
downloadnetsurf-6b29a697b9879c03146cca24bb30c64d25810cb8.tar.gz
netsurf-6b29a697b9879c03146cca24bb30c64d25810cb8.tar.bz2
check ftell return value coverity 1109870
-rw-r--r--utils/container.c9
1 files changed, 8 insertions, 1 deletions
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"));