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
p96114175 committed May 25, 2024
1 parent b8e20f6 commit 4a72378
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ 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,
prog_basename);
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 4a72378

Please sign in to comment.