aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-04-23 00:10:40 +0700
committerShulhan <ms@kilabit.info>2022-04-23 00:16:08 +0700
commitdfc8f91eebcb77add23f7460e5cddef9f5f9140a (patch)
treed2656c177d5e6ac786eb52d16310fc9b70e65c22
parent40cc7c23f14332d3aeabee7d25002e984d9062cb (diff)
downloadrescached-dfc8f91eebcb77add23f7460e5cddef9f5f9140a.tar.xz
all: fix panic if a nil HostsFiles and/or Zones is accessed
-rw-r--r--environment.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/environment.go b/environment.go
index fad9c4e..b5c226c 100644
--- a/environment.go
+++ b/environment.go
@@ -116,6 +116,9 @@ func LoadEnvironment(dirBase, fileConfig string) (env *Environment, err error) {
// newEnvironment create and initialize options with default values.
func newEnvironment(dirBase, fileConfig string) *Environment {
return &Environment{
+ HostsFiles: make(map[string]*dns.HostsFile),
+ Zones: make(map[string]*dns.Zone),
+
dirBase: dirBase,
pathDirBlock: filepath.Join(dirBase, dirBlock),
pathDirCaches: filepath.Join(dirBase, dirCaches),