Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/common/language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,11 @@ ELanguage PchLanguageICUCodeToELanguage( const char *pchICUCode, ELanguage eDefa
if ( !pchICUCode )
return eDefault;

// Match to no more than the param length so either a short 'en' or
// full 'zh-Hant' can match
int nLen = Q_strlen( pchICUCode );

// we only have 5 character ICU codes so this should be enough room
char rchCleanedCode[ 6 ];
// we only have 5 character ICU codes but 'es_419' has 6 characters, so we increase the buffer to 8
char rchCleanedCode[ 8 ];
Q_strncpy( rchCleanedCode, pchICUCode, Q_ARRAYSIZE( rchCleanedCode ) );
if( nLen >= 3 && rchCleanedCode[ 2 ] == '-' )
int nLen = ( int ) Q_strlen( rchCleanedCode );
if ( nLen >= 3 && rchCleanedCode[ 2 ] == '-' )
{
rchCleanedCode[ 2 ] = '_';
}
Expand Down