Compare commits
2 Commits
9dfef1d67f
...
6a513bbcac
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a513bbcac | |||
| 69e61c5811 |
@@ -123,8 +123,8 @@ type HTTPFuzzTestCase struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *FuzzTestHelper) validateHTTPRequest(t *testing.T, req *http.Request) {
|
func (h *FuzzTestHelper) validateHTTPRequest(t *testing.T, req *http.Request) {
|
||||||
pathParts := strings.Split(req.URL.Path, "/")
|
pathParts := strings.SplitSeq(req.URL.Path, "/")
|
||||||
for _, part := range pathParts {
|
for part := range pathParts {
|
||||||
if !utf8.ValidString(part) {
|
if !utf8.ValidString(part) {
|
||||||
t.Fatal("Path contains invalid UTF-8")
|
t.Fatal("Path contains invalid UTF-8")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,12 +40,7 @@ func (f *FuzzInputValidator) ValidateFuzzInputStrict(data []byte) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
input := string(data)
|
input := string(data)
|
||||||
|
return len(strings.TrimSpace(input)) != 0
|
||||||
if len(strings.TrimSpace(input)) == 0 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateUTF8String(s string) {
|
func ValidateUTF8String(s string) {
|
||||||
@@ -210,8 +205,8 @@ func (r *FuzzHTTPRequest) CreateTestRequest(method, url string, body []byte, hea
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *FuzzHTTPRequest) ValidateHTTPRequest(req *http.Request) {
|
func (r *FuzzHTTPRequest) ValidateHTTPRequest(req *http.Request) {
|
||||||
pathParts := strings.Split(req.URL.Path, "/")
|
pathParts := strings.SplitSeq(req.URL.Path, "/")
|
||||||
for _, part := range pathParts {
|
for part := range pathParts {
|
||||||
ValidateUTF8String(part)
|
ValidateUTF8String(part)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user