ftell can return -1 to indicate error, so trap for that

Fixes Coverity CID1039358

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-11-18 12:37:38 +00:00
parent 41a700b2d5
commit 7575883a56
1 changed files with 7 additions and 0 deletions

View File

@ -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)