summaryrefslogtreecommitdiff
path: root/caddyconfig
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-10-30 11:48:21 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-10-30 11:48:21 -0600
commit1be121cec7f4f43bd82001d4e5ee770005e42d52 (patch)
treed8321d8e4efafb90b919b6e7021c721f7aa78f07 /caddyconfig
parentdccba71276796999f3e16a6560016dc5dd0a952a (diff)
fuzz: Don't call Load() in HTTP caddyfile adapter fuzz tests
Doing so has a tendency to request certificates...
Diffstat (limited to 'caddyconfig')
-rw-r--r--caddyconfig/httpcaddyfile/adapter_fuzz.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/caddyconfig/httpcaddyfile/adapter_fuzz.go b/caddyconfig/httpcaddyfile/adapter_fuzz.go
index 1748b66..2aaead7 100644
--- a/caddyconfig/httpcaddyfile/adapter_fuzz.go
+++ b/caddyconfig/httpcaddyfile/adapter_fuzz.go
@@ -18,9 +18,6 @@
package httpcaddyfile
import (
- "bytes"
-
- "github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
)
@@ -28,7 +25,9 @@ func FuzzHTTPCaddyfileAdapter(data []byte) int {
adapter := caddyfile.Adapter{
ServerType: ServerType{},
}
- b, warns, err := adapter.Adapt(data, nil)
+
+ _, warns, err := adapter.Adapt(data, nil)
+
// Adapt func calls the Setup() func of the ServerType,
// thus it's going across multiple layers, each can
// return warnings or errors. Marking the presence of
@@ -36,14 +35,9 @@ func FuzzHTTPCaddyfileAdapter(data []byte) int {
// could push the fuzzer towards a path where we only
// catch errors. Let's push the fuzzer to where it passes
// but breaks.
- if (err != nil) || (warns != nil && len(warns) > 0) {
+ if err != nil || (warns != nil && len(warns) > 0) {
return 0
}
- // adapted Caddyfile should be parseable by the configuration loader in admin.go
- err = caddy.Load(bytes.NewReader(b))
- if err != nil {
- return 0
- }
return 1
}