Browse Source

Fix buffer overflow

gravgun
mittorn 7 years ago
parent
commit
cbb029817f
  1. 2
      dlls/enttools.h
  2. 4
      dlls/gravgunmod.cpp
  3. 2
      dlls/gravgunmod.h

2
dlls/enttools.h

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

4
dlls/gravgunmod.cpp

@ -180,10 +180,10 @@ void GGM_ClientPutinServer(edict_t *pEntity, CBasePlayer *pPlayer) @@ -180,10 +180,10 @@ void GGM_ClientPutinServer(edict_t *pEntity, CBasePlayer *pPlayer)
pPlayer->gravgunmod_data.m_state = STATE_CONNECTED;
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" );
strncpy( pPlayer->gravgunmod_data.uid, uid, 31 );
strncpy( pPlayer->gravgunmod_data.uid, uid, 32 );
pPlayer->gravgunmod_data.uid[32] = 0;
pPlayer->gravgunmod_data.m_flEntTime = 0;
pPlayer->gravgunmod_data.m_flEntScope = 0;

2
dlls/gravgunmod.h

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

Loading…
Cancel
Save