Skip to content

Commit

Permalink
options: reject empty runroot or graphroot
Browse files Browse the repository at this point in the history
make sure that the runroot and graphroot are not empty otherwise we will
end up using an empty directory as path prefix and create files in the
current directory.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Feb 16, 2023
1 parent 0d8301b commit 6ae905a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions types/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,18 @@ func defaultStoreOptionsIsolated(rootless bool, rootlessUID int, storageConf str
}
}
}
if storageOpts.RunRoot != "" {
if storageOpts.RunRoot == "" {
return storageOpts, fmt.Errorf("runroot must be set")
} else {
runRoot, err := expandEnvPath(storageOpts.RunRoot, rootlessUID)
if err != nil {
return storageOpts, err
}
storageOpts.RunRoot = runRoot
}
if storageOpts.GraphRoot != "" {
if storageOpts.GraphRoot == "" {
return storageOpts, fmt.Errorf("graphroot must be set")
} else {
graphRoot, err := expandEnvPath(storageOpts.GraphRoot, rootlessUID)
if err != nil {
return storageOpts, err
Expand Down

0 comments on commit 6ae905a

Please sign in to comment.