Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #5833 from ActiveState/fix_nsinit_env_panic
Browse files Browse the repository at this point in the history
fix panic when passing empty environment
  • Loading branch information
crosbymichael committed May 16, 2014
2 parents 8f77887 + d636e8a commit afea8ea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nsinit/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ func LoadContainerEnvironment(container *libcontainer.Container) error {
os.Clearenv()
for _, pair := range container.Env {
p := strings.SplitN(pair, "=", 2)
if len(p) < 2 {
return fmt.Errorf("invalid environment '%v'", pair)
}
if err := os.Setenv(p[0], p[1]); err != nil {
return err
}
Expand Down

0 comments on commit afea8ea

Please sign in to comment.