[Bf-blender-cvs] [b14243be77b] master: blenlib: BLI_file_attributes() Correction

Harley Acheson noreply at git.blender.org
Fri May 15 17:12:07 CEST 2020


Commit: b14243be77b2fdc30781e4c5f5d90c27d08dbbfb
Author: Harley Acheson
Date:   Fri May 15 08:10:57 2020 -0700
Branches: master
https://developer.blender.org/rBb14243be77b2fdc30781e4c5f5d90c27d08dbbfb

blenlib: BLI_file_attributes() Correction

Adds an Correction to properly handle possibility of overflow of path name.

Differential Revision: https://developer.blender.org/D7739

Reviewed by Brecht Van Lommel

===================================================================

M	source/blender/blenlib/intern/storage.c

===================================================================

diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 154fc966ca2..87536ea8116 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -233,8 +233,9 @@ eFileAttributes BLI_file_attributes(const char *path)
 
 #  ifdef WIN32
   WCHAR wline[FILE_MAXDIR];
-  size_t bsize = count_utf_16_from_8(path);
-  conv_utf_8_to_16(path, wline, bsize);
+  if (conv_utf_8_to_16(path, wline, ARRAY_SIZE(wline)) != 0) {
+    return ret;
+  }
   DWORD attr = GetFileAttributesW(wline);
   if (attr & FILE_ATTRIBUTE_READONLY) {
     ret |= FILE_ATTR_READONLY;



More information about the Bf-blender-cvs mailing list