Skip to content

Commit

Permalink
Replace sprintf with safer snprintf
Browse files Browse the repository at this point in the history
The sprintf function has been replaced with the safer snprintf function
to prevent potential buffer overflow vulnerabilities and enhance
security.
  • Loading branch information
huaxinliao committed May 25, 2024
1 parent b8e20f6 commit 9d6e515
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static bool parse_args(int argc, char **args)
strlen(prog_basename) + 5 + 1);
assert(prof_out_file);

sprintf(prof_out_file, "%s/%s%s.prof", cwd_path, rel_path,
snprintf(prof_out_file, sizeof(prof_out_file), "%s/%s%s.prof", cwd_path, rel_path,
prog_basename);
}
return true;
Expand Down

0 comments on commit 9d6e515

Please sign in to comment.