Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-06-05 04:46:01 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-06-05 04:46:01 +0300
commitaca40295e8ac868b6e3aec40bbcd388177508c1f (patch)
tree5f9f329021231b8434581b9ea786dec431ecfd96 /source/blender/blenlib/intern/storage.c
parentb2e5c017a1a93ec9b6f001bae385c7cc9b756cca (diff)
Check ftell return values
Diffstat (limited to 'source/blender/blenlib/intern/storage.c')
-rw-r--r--source/blender/blenlib/intern/storage.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 046dba26c69..6394187d40a 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -296,6 +296,11 @@ LinkNode *BLI_file_read_as_lines(const char *name)
size = (size_t)ftell(fp);
fseek(fp, 0, SEEK_SET);
+ if (UNLIKELY(size == (size_t)-1)) {
+ fclose(fp);
+ return NULL;
+ }
+
buf = MEM_mallocN(size, "file_as_lines");
if (buf) {
size_t i, last = 0;