You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a new job, I set executor=shell, but forgot to set executor_config.
When this job executes, it will cause invalid memory address or nil pointer dereference and panics dkron agent.
To Reproduce
Steps to reproduce the behavior:
add a new job
set executor=shell
leave executor_config blank
run this job
Expected behavior
Empty Executor Config in a job should do nothing and will not panics dkron agent
Bug
In dkron/builtin/bins/dkron-executor-shell/shell.go, Line 150-176:
// Determine the shell invocation based on OS
func buildCmd(command string, useShell bool, env []string, cwd string) (cmd *exec.Cmd, err error) {
var shell, flag string
if useShell {
if runtime.GOOS == windows {
shell = "cmd"
flag = "/C"
} else {
shell = "/bin/sh"
flag = "-c"
}
cmd = exec.Command(shell, flag, command)
} else {
args, err := shellwords.Parse(command)
if err != nil {
return nil, err
}
cmd = exec.Command(args[0], args[1:]...)
}
if env != nil {
cmd.Env = append(os.Environ(), env...)
}
cmd.Dir = cwd
return
}
if command is an empty string, then args is a empty array.
args[0] and args[1:] will out of array bounds and cause invalid memory address or nil pointer dereference.
The text was updated successfully, but these errors were encountered:
Describe the bug
In a new job, I set
executor=shell
, but forgot to setexecutor_config
.When this job executes, it will cause
invalid memory address or nil pointer dereference
and panicsdkron agent
.To Reproduce
Steps to reproduce the behavior:
executor=shell
executor_config
blankExpected behavior
Empty Executor Config in a job should do nothing and will not panics
dkron agent
Bug
In
dkron/builtin/bins/dkron-executor-shell/shell.go
, Line 150-176:if
command
is an empty string, thenargs
is a empty array.args[0]
andargs[1:]
will out of array bounds and causeinvalid memory address or nil pointer dereference
.The text was updated successfully, but these errors were encountered: