Fix buffer overflow

This commit is contained in:
mittorn 2017-11-14 12:02:51 +00:00
parent 356951d2f7
commit cbb029817f
3 changed files with 4 additions and 4 deletions

View File

@ -8,7 +8,7 @@ void ENT_RegisterCVars( void );
struct EntoolsEntData { struct EntoolsEntData {
bool enttools; // created by enttools bool enttools; // created by enttools
char ownerid[32]; char ownerid[33];
}; };
#endif // ENTTOOLS_H #endif // ENTTOOLS_H

View File

@ -180,10 +180,10 @@ void GGM_ClientPutinServer(edict_t *pEntity, CBasePlayer *pPlayer)
pPlayer->gravgunmod_data.m_state = STATE_CONNECTED; pPlayer->gravgunmod_data.m_state = STATE_CONNECTED;
const char *uid = GETPLAYERAUTHID( pPlayer->edict() ); const char *uid = GETPLAYERAUTHID( pPlayer->edict() );
if( strstr(uid, "PENDING") ) if( !uid || strstr(uid, "PENDING") )
uid = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "ip" ); uid = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "ip" );
strncpy( pPlayer->gravgunmod_data.uid, uid, 31 ); strncpy( pPlayer->gravgunmod_data.uid, uid, 32 );
pPlayer->gravgunmod_data.uid[32] = 0; pPlayer->gravgunmod_data.uid[32] = 0;
pPlayer->gravgunmod_data.m_flEntTime = 0; pPlayer->gravgunmod_data.m_flEntTime = 0;
pPlayer->gravgunmod_data.m_flEntScope = 0; pPlayer->gravgunmod_data.m_flEntScope = 0;

View File

@ -55,7 +55,7 @@ struct GGMData
int m_iConfirmKey; int m_iConfirmKey;
float m_flEntScope; float m_flEntScope;
float m_flEntTime; float m_flEntTime;
char uid[32]; char uid[33];
}; };
#endif // GRAVGUNMOD_H #endif // GRAVGUNMOD_H