Browse Source

engine: server: avoid unaligned access in pfnMessageEnd

pull/2/head
Alibek Omarov 2 years ago
parent
commit
375c06400c
  1. 7
      engine/server/sv_game.c

7
engine/server/sv_game.c

@ -2642,6 +2642,7 @@ void GAME_EXPORT pfnMessageEnd( void )
{ {
const char *name = "Unknown"; const char *name = "Unknown";
float *org = NULL; float *org = NULL;
word realsize;
if( svgame.msg_name ) name = svgame.msg_name; if( svgame.msg_name ) name = svgame.msg_name;
if( !svgame.msg_started ) Host_Error( "MessageEnd: called with no active message\n" ); if( !svgame.msg_started ) Host_Error( "MessageEnd: called with no active message\n" );
@ -2673,7 +2674,8 @@ void GAME_EXPORT pfnMessageEnd( void )
return; return;
} }
*(word *)&sv.multicast.pData[svgame.msg_size_index] = svgame.msg_realsize; realsize = svgame.msg_realsize;
memcpy( &sv.multicast.pData[svgame.msg_size_index], &realsize, sizeof( realsize ));
} }
} }
else if( svgame.msg[svgame.msg_index].size != -1 ) else if( svgame.msg[svgame.msg_index].size != -1 )
@ -2705,7 +2707,8 @@ void GAME_EXPORT pfnMessageEnd( void )
return; return;
} }
*(word *)&sv.multicast.pData[svgame.msg_size_index] = svgame.msg_realsize; realsize = svgame.msg_realsize;
memcpy( &sv.multicast.pData[svgame.msg_size_index], &realsize, sizeof( realsize ));
} }
else else
{ {

Loading…
Cancel
Save