Skip to content

Commit

Permalink
verify generated agent binary
Browse files Browse the repository at this point in the history
check if config data is written successfully
  • Loading branch information
jm33-m0 committed Jan 29, 2024
1 parent 2f55dbd commit 4033979
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/lib/cc/buildAgent.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ func GenAgent() (agent_binary_path string) {
bytes.Repeat([]byte{0}, len(config_payload)),
config_payload,
1)
// verify
if !bytes.Contains(toWrite, config_payload) {
CliPrintError("Failed to patch %s with config payload", stubFile)
return
}
// write
err = os.WriteFile(outfile, toWrite, 0755)
if err != nil {
Expand Down

0 comments on commit 4033979

Please sign in to comment.