lockdown on some validation
This commit is contained in:
parent
6e60709283
commit
d5ea2e2974
1 changed files with 10 additions and 2 deletions
|
|
@ -539,8 +539,16 @@ bool Supervisor::run_command(Command& cmd) {
|
|||
return true;
|
||||
}
|
||||
case K::Setenv:
|
||||
if (cmd.args.size() >= 1)
|
||||
::setenv(cmd.args[0].c_str(), cmd.args[1].c_str(), 1);
|
||||
if (cmd.args.size() != 2) {
|
||||
log_status(LogStatus::Failed, "setenv requires NAME and VALUE");
|
||||
return false;
|
||||
}
|
||||
if (::setenv(cmd.args[0].c_str(), cmd.args[1].c_str(), 1) != 0) {
|
||||
log_status(LogStatus::Failed,
|
||||
"Failed to set environment variable " + cmd.args[0] +
|
||||
": " + std::strerror(errno));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case K::Write: {
|
||||
if (cmd.args.size() >= 2) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue