[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: freetype/win32: fix bogus string cast

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Jun 8 13:48:19 UTC 2024



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
947e2453 by Steve Lhomme at 2024-06-08T13:22:37+00:00
freetype/win32: fix bogus string cast

lfFaceName is a WCHAR table.

(cherry picked from commit f4d040e050a1c0c484d8334442c7a93c5c809df4) (edited)
edited:
- 3.0 uses the tchar API

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
ed469a13 by Steve Lhomme at 2024-06-08T13:22:37+00:00
freetype/win32: fix string constant when using WCHAR/wchar_t API's explicitely

wcscat_s is part of msvcrt.dll so should be in Windows XP.

(cherry picked from commit ab501d6a93f25064adf17456340f9ab965855571) (edited)
edited:
- 3.0 was already using a long constant

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -


1 changed file:

- modules/text_renderer/freetype/fonts/win32.c


Changes:

=====================================
modules/text_renderer/freetype/fonts/win32.c
=====================================
@@ -170,7 +170,7 @@ static char* GetWindowsFontPath()
     if( S_OK != SHGetFolderPathW( NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, wdir ) )
     {
         GetWindowsDirectoryW( wdir, MAX_PATH );
-        wcscat( wdir, L"\\fonts" );
+        wcscat_s( wdir, MAX_PATH, L"\\fonts" );
     }
     return FromWide( wdir );
 }
@@ -422,7 +422,7 @@ const vlc_family_t *Win32_GetFamily( filter_t *p_filter, const char *psz_family
     lf.lfCharSet = DEFAULT_CHARSET;
 
     LPTSTR psz_fbuffer = ToT( psz_family );
-    _tcsncpy( (LPTSTR)&lf.lfFaceName, psz_fbuffer, LF_FACESIZE );
+    _tcsncpy( lf.lfFaceName, psz_fbuffer, ARRAY_SIZE(lf.lfFaceName) );
     free( psz_fbuffer );
 
     /* */
@@ -477,7 +477,7 @@ static char *UniscribeFallback( const char *psz_family, uni_char_t codepoint )
     psz_fbuffer = ToT( psz_family );
     if( !psz_fbuffer )
         goto error;
-    _tcsncpy( ( LPTSTR ) &lf.lfFaceName, psz_fbuffer, LF_FACESIZE );
+    _tcsncpy( lf.lfFaceName, psz_fbuffer, ARRAY_SIZE(lf.lfFaceName) );
     free( psz_fbuffer );
 
     lf.lfCharSet = DEFAULT_CHARSET;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4071ece4bbfc860ea0793aed8589db6bb1329f32...ed469a1388bf482cd8febf5fe7d2c47dd7ea68c2

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4071ece4bbfc860ea0793aed8589db6bb1329f32...ed469a1388bf482cd8febf5fe7d2c47dd7ea68c2
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list