From dfc8f91eebcb77add23f7460e5cddef9f5f9140a Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sat, 23 Apr 2022 00:10:40 +0700 Subject: all: fix panic if a nil HostsFiles and/or Zones is accessed --- environment.go | 3 +++ 1 file changed, 3 insertions(+) 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), -- cgit v1.3