diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2020-05-15 18:10:57 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2020-05-15 18:11:57 +0300 |
commit | b14243be77b2fdc30781e4c5f5d90c27d08dbbfb (patch) | |
tree | 944214757d2eca6975b9db3fe944552951e7e715 | |
parent | 0f2c7f386487b8839eac4a83762549ea899a279d (diff) |
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
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 5 |
1 files changed, 3 insertions, 2 deletions
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; |