Skip to content

Commit

Permalink
fixup! Replace some strncpy with memcpy/snprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikba committed Jan 17, 2022
1 parent d1b92c1 commit 2d9b490
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion linux/cpumeter.cc
Expand Up @@ -327,7 +327,7 @@ const char *CPUMeter::cpuStr(int num){

const char *CPUMeter::toUpper(const char *str){
static char buffer[MAX_PROCSTAT_LENGTH + 1];
memcpy(buffer, str, MAX_PROCSTAT_LENGTH);
snprintf(buffer, MAX_PROCSTAT_LENGTH + 1, "%s", str);
buffer[MAX_PROCSTAT_LENGTH] = 0;
for (char *tmp = buffer ; *tmp != '\0' ; tmp++)
*tmp = toupper(*tmp);
Expand Down

0 comments on commit 2d9b490

Please sign in to comment.