Fix coverity reported strcat/strcpy potential overflows
This commit is contained in:
parent
140d17bf82
commit
2330b13864
|
@ -97,7 +97,7 @@ static int okRevision( const std::string& aField )
|
|||
if( aField.size() >= 4 )
|
||||
{
|
||||
strcpy( rev, "x/" );
|
||||
strcat( rev, aField.c_str() );
|
||||
strncat( rev, aField.c_str(), sizeof(rev)-strlen(rev)-1 );
|
||||
|
||||
if( EndsWithRev( rev, rev + strlen(rev), '/' ) == rev+2 )
|
||||
return -1; // success
|
||||
|
|
|
@ -597,7 +597,10 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
|
|||
ReportMessage( _( "Too many include files!!" ) );
|
||||
break;
|
||||
}
|
||||
strcpy( line, text );
|
||||
|
||||
strncpy( line, text, sizeof(line)-1 );
|
||||
line[sizeof(line)-1] = '\0';
|
||||
|
||||
strtok( line, "*%%\n\r" );
|
||||
m_FilesList[m_FilesPtr] = m_Current_File;
|
||||
|
||||
|
|
|
@ -108,7 +108,8 @@ COMPONENT* LEGACY_NETLIST_READER::loadComponent( char* aText )
|
|||
wxString name; // the name of component that was placed in the schematic
|
||||
char line[1024];
|
||||
|
||||
strcpy( line, aText );
|
||||
strncpy( line, aText, sizeof(line)-1 );
|
||||
line[sizeof(line)-1] = '\0';
|
||||
|
||||
value = wxT( "~" );
|
||||
|
||||
|
|
Loading…
Reference in New Issue