engine: resources: sysctl: Be more careful about dir path

More validation is not bad!
This commit is contained in:
James Shubin
2024-09-18 21:39:33 -04:00
parent ccb4c6244d
commit 06a023ca66

View File

@@ -47,6 +47,9 @@ import (
func init() {
engine.RegisterResource("sysctl", func() engine.Res { return &SysctlRes{} })
if !strings.HasPrefix(SysctlConfDir, "/") {
panic("the SysctlConfDir does not start with a slash")
}
if !strings.HasSuffix(SysctlConfDir, "/") {
panic("the SysctlConfDir does not end with a slash")
}