Also treat file reading as an error if ftell reports invalid length.

`ftell` is documented to return -1L if the function failed to get the current position indicator in the stream.  The possibility is easily set aside just by checking if the function returned a negative length.
This commit is contained in:
unknown 2015-02-19 17:54:13 -05:00
parent 429eb3d1d5
commit 586c620609

View File

@ -110,6 +110,8 @@ static bool read_generic_file(const char *path, void **buf, ssize_t *len)
fseek(file, 0, SEEK_END);
_len = ftell(file);
if (_len < 0)
goto error;
rewind(file);