Skip to content

Commit

Permalink
Add input validation in get_device_serial() function
Browse files Browse the repository at this point in the history
Add const to char *cmd

Signed-off-by: Shrikant Temburwar <shrikant.temburwar@intel.com>
  • Loading branch information
shrikant1407 committed Nov 20, 2023
1 parent 0f18bae commit 452b689
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions storage/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,18 @@ int print_timestamp(void)
}

#if defined(GET_DEV_SERIAL)
// Get device serial number
/**
* Internal API
* Get device serial number from system BIOS table
* */
int get_device_serial(char *serial_buff)
{
if (!serial_buff) {
return -1;
}

FILE *fp;
char *cmd = "dmidecode -s system-serial-number";
const char *cmd = "dmidecode -s system-serial-number";
int out_sz;
char out[MAX_DEV_SERIAL_SZ];
int results_sz = 0;
Expand Down

0 comments on commit 452b689

Please sign in to comment.