mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-12-13 21:51:09 +00:00
* (bug 3454) Fix crash in autocompletion due to incorrect strncpy buffer size
This commit is contained in:
parent
dfc97a1dfa
commit
6113cf7a68
1 changed files with 6 additions and 3 deletions
|
@ -3292,6 +3292,8 @@ static void Field_CompleteCommand( char *cmd,
|
|||
}
|
||||
else
|
||||
{
|
||||
int completionOffset;
|
||||
|
||||
if( completionString[0] == '\\' || completionString[0] == '/' )
|
||||
completionString++;
|
||||
|
||||
|
@ -3310,9 +3312,10 @@ static void Field_CompleteCommand( char *cmd,
|
|||
if( matchCount == 0 )
|
||||
return; // no matches
|
||||
|
||||
Q_strncpyz( &completionField->buffer[ strlen( completionField->buffer ) -
|
||||
strlen( completionString ) ], shortestMatch,
|
||||
sizeof( completionField->buffer ) );
|
||||
completionOffset = strlen( completionField->buffer ) - strlen( completionString );
|
||||
|
||||
Q_strncpyz( &completionField->buffer[ completionOffset ], shortestMatch,
|
||||
sizeof( completionField->buffer ) - completionOffset );
|
||||
|
||||
completionField->cursor = strlen( completionField->buffer );
|
||||
|
||||
|
|
Loading…
Reference in a new issue