mirror of
https://github.com/FWGS/hlsdk-xash3d
synced 2024-11-21 17:36:18 +01:00
client: MOTD: Prevent out of bounds access on x86.
This commit is contained in:
parent
2218731a86
commit
dd6995ecbd
@ -73,7 +73,7 @@ int CHudMOTD::Draw( float fTime )
|
||||
//bool bScroll;
|
||||
// find the top of where the MOTD should be drawn, so the whole thing is centered in the screen
|
||||
int ypos = ( ScreenHeight - LINE_HEIGHT * m_iLines ) / 2; // shift it up slightly
|
||||
char *ch = m_szMOTD;
|
||||
unsigned char *ch = (unsigned char*)m_szMOTD;
|
||||
int xpos = ( ScreenWidth - gHUD.m_scrinfo.charWidths['M'] * m_iMaxLength ) / 2;
|
||||
if( xpos < 30 )
|
||||
xpos = 30;
|
||||
@ -95,11 +95,13 @@ int CHudMOTD::Draw( float fTime )
|
||||
gHUD.DrawDarkRectangle( xpos - 5, ypos_r - 5, xmax - xpos + 10, height + 10 );
|
||||
while( *ch )
|
||||
{
|
||||
char *next_line;
|
||||
int line_length = 0; // count the length of the current line
|
||||
unsigned char *next_line;
|
||||
for( next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ )
|
||||
line_length += gHUD.m_scrinfo.charWidths[*next_line];
|
||||
char *top = next_line;
|
||||
;
|
||||
// int line_length = 0; // count the length of the current line
|
||||
// for( next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ )
|
||||
// line_length += gHUD.m_scrinfo.charWidths[*next_line];
|
||||
unsigned char *top = next_line;
|
||||
if( *top == '\n' )
|
||||
*top = 0;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user