libbluray | branch: master | ace20022 <[email protected]> | Thu Nov 12 13:07:31 2015 +0100| [36ce17026ea5ca0915e99d2c7def362810f751c6] | committer: hpi1
Add some checks to win32_get_font_dir(). > http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=36ce17026ea5ca0915e99d2c7def362810f751c6 --- src/file/dirs_win32.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/file/dirs_win32.c b/src/file/dirs_win32.c index 5279ea5..e165fea 100644 --- a/src/file/dirs_win32.c +++ b/src/file/dirs_win32.c @@ -38,8 +38,16 @@ char *win32_get_font_dir(const char *font_file) { wchar_t wdir[MAX_PATH]; if (S_OK != SHGetFolderPathW(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, wdir)) { - GetWindowsDirectoryW(wdir, MAX_PATH); - wcscat(wdir, L"\\fonts"); + int lenght = GetWindowsDirectoryW(wdir, MAX_PATH); + if (lenght == 0 || lenght > (MAX_PATH - 8)) { + BD_DEBUG(DBG_FILE, "Font directory path too long!\n"); + return NULL; + } + if (!wcscat(wdir, L"\\fonts")) { + BD_DEBUG(DBG_FILE, "Could not construct font directory path!\n"); + return NULL; + } + } int len = WideCharToMultiByte (CP_UTF8, 0, wdir, -1, NULL, 0, NULL, NULL); _______________________________________________ libbluray-devel mailing list [email protected] https://mailman.videolan.org/listinfo/libbluray-devel
