Skip to content

Commit

Permalink
check that i.executionSysProcAttr.Credential != nil before using it t…
Browse files Browse the repository at this point in the history
…o change permissions on temp file
  • Loading branch information
b-dean committed Apr 10, 2024
1 parent a36b941 commit bc75270
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ func (i *Instance) genExecutorTmpFile(codeReader io.Reader) (path string, error
}

// Need to set the permissions here or the file will be owned by root and the execution will fail
if i.executionSysProcAttr != nil {
if i.executionSysProcAttr != nil && i.executionSysProcAttr.Credential != nil {
if err := os.Chown(
tmpFile.Name(),
int(i.executionSysProcAttr.Credential.Uid),
Expand Down

0 comments on commit bc75270

Please sign in to comment.