Skip to content

Commit

Permalink
Merge pull request #204 from PartialVolume/fix_overflow_warning
Browse files Browse the repository at this point in the history
Fix overflow warning
  • Loading branch information
PartialVolume authored Mar 10, 2020
2 parents 14d285f + 87199a1 commit e2ec6a5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ int nwipe_log_sysinfo()
{
FILE* fp;
char path[256];
char cmd[50];
int len;
int r; // A result buffer.

Expand Down Expand Up @@ -428,14 +427,19 @@ int nwipe_log_sysinfo()
"processor-frequency",
"" // terminates the keyword array. DO NOT REMOVE
};

char dmidecode_command[] = "dmidecode -s %s";

char cmd[sizeof( dmidecode_keywords ) + sizeof( dmidecode_command )];

unsigned int keywords_idx;

keywords_idx = 0;

/* Run the dmidecode command to retrieve each dmidecode keyword, one at a time */
while( dmidecode_keywords[keywords_idx][0] != 0 )
{
sprintf( cmd, "dmidecode -s %s", &dmidecode_keywords[keywords_idx][0] );
sprintf( cmd, dmidecode_command, &dmidecode_keywords[keywords_idx][0] );
fp = popen( cmd, "r" );
if( fp == NULL )
{
Expand Down

0 comments on commit e2ec6a5

Please sign in to comment.