LIB_ID: change strcpy() to strncpy() for safety

This commit is contained in:
Maciej Suminski 2018-03-06 14:25:18 +01:00
parent e62db2841a
commit aff350f593
1 changed files with 2 additions and 2 deletions

View File

@ -93,11 +93,11 @@ static inline int okLogical( const UTF8& aField )
static int okRevision( const UTF8& aField ) static int okRevision( const UTF8& aField )
{ {
char rev[32]; // C string for speed char rev[32]; // C string for speed
if( aField.size() >= 4 ) if( aField.size() >= 4 )
{ {
strcpy( rev, "x/" ); strncpy( rev, "x/", sizeof( rev ) );
strncat( rev, aField.c_str(), sizeof(rev)-strlen(rev)-1 ); strncat( rev, aField.c_str(), sizeof(rev)-strlen(rev)-1 );
if( EndsWithRev( rev, rev + strlen(rev), '/' ) == rev+2 ) if( EndsWithRev( rev, rev + strlen(rev), '/' ) == rev+2 )