Skip to content

Commit

Permalink
Fix #37, termination on strncpy
Browse files Browse the repository at this point in the history
Fix possible non-termination of strings within command line parsing.
This generated a warning in GCC9.
  • Loading branch information
jphickey committed Apr 27, 2020
1 parent 3c4be59 commit 3f68b98
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions elf2cfetbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,13 +936,15 @@ int32 ProcessCmdLineOptions(int ArgumentCount, char *Arguments[])
if ((Arguments[i][0] == '-') && (Arguments[i][1] == 't'))
{
// Extract the Table Name Override
strncpy(TableName, &Arguments[i][2], 38);
strncpy(TableName, &Arguments[i][2], sizeof(TableName)-1);
TableName[sizeof(TableName)-1] = 0;
TableNameOverride = true;
}
else if ((Arguments[i][0] == '-') && (Arguments[i][1] == 'd'))
{
// Extract the Description Override
strncpy(Description, &Arguments[i][2], 32);
strncpy(Description, &Arguments[i][2], sizeof(Description)-1);
Description[sizeof(Description)-1] = 0;
DescriptionOverride = true;
}
else if ((Arguments[i][0] == '-') && (Arguments[i][1] == 's'))
Expand Down

0 comments on commit 3f68b98

Please sign in to comment.