Problem: Coverity complains about possible negative value.
Solution: Check return value of ftell() not to be negative.
{
int i;
size_t len;
+ long llen;
char_u *p;
int dir;
goto notfound;
}
fseek(fd, 0L, SEEK_END);
- len = ftell(fd); /* get size of temp file */
+ llen = ftell(fd); /* get size of temp file */
fseek(fd, 0L, SEEK_SET);
- buffer = alloc(len + 1);
+ if (llen < 0)
+ /* just in case ftell() would fail */
+ buffer = NULL;
+ else
+ buffer = alloc(llen + 1);
if (buffer == NULL)
{
/* out of memory */
fclose(fd);
return FAIL;
}
+ len = llen;
i = fread((char *)buffer, 1, len, fd);
fclose(fd);
mch_remove(tempname);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 526,
/**/
525,
/**/