Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
fuzz: Don't call Load() in HTTP caddyfile adapter fuzz tests
Doing so has a tendency to request certificates...
Matthew Holt committed
Oct 30, 2019 at 11:48 UTC
1be121cec7f4f43bd82001d4e5ee770005e42d52
1 file changed
+4
-10
caddyconfig/httpcaddyfile/adapter_fuzz.go
+4
-10
@@ -18,9 +18,6 @@
18
package httpcaddyfile
19
20
import (
21
- "bytes"
22
-
23
- "github.com/caddyserver/caddy/v2"
21
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
22
)
23
@@ -28,7 +25,9 @@ func FuzzHTTPCaddyfileAdapter(data []byte) int {
25
adapter := caddyfile.Adapter{
26
ServerType: ServerType{},
27
}
31
- b, warns, err := adapter.Adapt(data, nil)
28
+
29
+ _, warns, err := adapter.Adapt(data, nil)
30
+
31
// Adapt func calls the Setup() func of the ServerType,
32
// thus it's going across multiple layers, each can
33
// return warnings or errors. Marking the presence of
@@ -36,14 +35,9 @@ func FuzzHTTPCaddyfileAdapter(data []byte) int {
35
// could push the fuzzer towards a path where we only
36
// catch errors. Let's push the fuzzer to where it passes
37
// but breaks.
39
- if (err != nil) || (warns != nil && len(warns) > 0) {
38
+ if err != nil || (warns != nil && len(warns) > 0) {
39
return 0
40
}
41
43
- // adapted Caddyfile should be parseable by the configuration loader in admin.go
44
- err = caddy.Load(bytes.NewReader(b))
45
- if err != nil {
46
- return 0
47
- }
42
return 1
43
}