From 7575883a56e0179c03fbfdbf8f49c406488b487d Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Mon, 18 Nov 2013 12:37:38 +0000 Subject: [PATCH] ftell can return -1 to indicate error, so trap for that Fixes Coverity CID1039358 Signed-off-by: Chris Michael --- src/bin/eet/eet_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/eet/eet_main.c b/src/bin/eet/eet_main.c index c2f0338..05ad423 100644 --- a/src/bin/eet/eet_main.c +++ b/src/bin/eet/eet_main.c @@ -328,6 +328,13 @@ do_eet_encode(const char *file, fseek(f, 0, SEEK_END); textlen = ftell(f); + if (textlen < 0) + { + ERR("cannot obtain current file position %s", out); + fclose(f); + exit(-1); + } + rewind(f); text = malloc(textlen); if (!text) -- 2.7.4