_s can fuck yourself

This commit is contained in:
Detanup01 2024-05-21 21:55:42 +02:00 committed by otavepto
parent 6a464fd295
commit 797bcc9523

View File

@ -42,9 +42,9 @@ struct MatchMakingKeyValuePair_t
MatchMakingKeyValuePair_t() { m_szKey[0] = m_szValue[0] = 0; } MatchMakingKeyValuePair_t() { m_szKey[0] = m_szValue[0] = 0; }
MatchMakingKeyValuePair_t( const char *pchKey, const char *pchValue ) MatchMakingKeyValuePair_t( const char *pchKey, const char *pchValue )
{ {
strncpy_s( m_szKey, pchKey, sizeof(m_szKey) ); // this is a public header, use basic c library string funcs only! strncpy( m_szKey, pchKey, sizeof(m_szKey) ); // this is a public header, use basic c library string funcs only!
m_szKey[ sizeof( m_szKey ) - 1 ] = '\0'; m_szKey[ sizeof( m_szKey ) - 1 ] = '\0';
strncpy_s( m_szValue, pchValue, sizeof(m_szValue) ); strncpy( m_szValue, pchValue, sizeof(m_szValue) );
m_szValue[ sizeof( m_szValue ) - 1 ] = '\0'; m_szValue[ sizeof( m_szValue ) - 1 ] = '\0';
} }
char m_szKey[ 256 ]; char m_szKey[ 256 ];
@ -156,9 +156,9 @@ inline const char *servernetadr_t::ToString( uint32 unIP, uint16 usPort ) const
static int nBuf = 0; static int nBuf = 0;
unsigned char *ipByte = (unsigned char *)&unIP; unsigned char *ipByte = (unsigned char *)&unIP;
#ifdef VALVE_BIG_ENDIAN #ifdef VALVE_BIG_ENDIAN
_snprintf_s (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[0]), (int)(ipByte[1]), (int)(ipByte[2]), (int)(ipByte[3]), usPort ); _snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[0]), (int)(ipByte[1]), (int)(ipByte[2]), (int)(ipByte[3]), usPort );
#else #else
_snprintf_s (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[3]), (int)(ipByte[2]), (int)(ipByte[1]), (int)(ipByte[0]), usPort ); _snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[3]), (int)(ipByte[2]), (int)(ipByte[1]), (int)(ipByte[0]), usPort );
#endif #endif
const char *pchRet = s[nBuf]; const char *pchRet = s[nBuf];
++nBuf; ++nBuf;
@ -243,7 +243,7 @@ inline const char* gameserveritem_t::GetName() const
inline void gameserveritem_t::SetName( const char *pName ) inline void gameserveritem_t::SetName( const char *pName )
{ {
strncpy_s( m_szServerName, pName, sizeof( m_szServerName ) ); strncpy( m_szServerName, pName, sizeof( m_szServerName ) );
m_szServerName[ sizeof( m_szServerName ) - 1 ] = '\0'; m_szServerName[ sizeof( m_szServerName ) - 1 ] = '\0';
} }