From: Marek Schimara Date: Fri, 17 Jun 2016 11:40:08 +0000 (+0200) Subject: src/rrd_cgi.c: fix Coverity CID#13625 Truncated stdio return value X-Git-Tag: v1.7.0~42^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4e09a380ce1114b1d2f05f0506c19d6a2d7a7e0b;p=thirdparty%2Frrdtool-1.x.git src/rrd_cgi.c: fix Coverity CID#13625 Truncated stdio return value --- diff --git a/src/rrd_cgi.c b/src/rrd_cgi.c index 4e527218..d1ebbb64 100644 --- a/src/rrd_cgi.c +++ b/src/rrd_cgi.c @@ -418,7 +418,12 @@ static int readfile( totalcnt = (ftell(input) + 1) / sizeof(char) - offset; if (totalcnt < MEMBLK) totalcnt = MEMBLK; /* sanitize */ - fseek(input, offset * sizeof(char), SEEK_SET); + if (fseek(input, offset * sizeof(char), SEEK_SET) == -1) + { + rrd_set_error("fseek() failed on %s: %s", file_name, rrd_strerror(errno)); + fclose(input); + return (-1); + } } if (((*buffer) = (char *) malloc((totalcnt + 4) * sizeof(char))) == NULL) { perror("Allocate Buffer:");