From b14243be77b2fdc30781e4c5f5d90c27d08dbbfb Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Fri, 15 May 2020 08:10:57 -0700 Subject: 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 --- source/blender/blenlib/intern/storage.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/blenlib') 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; -- cgit v1.2.3