Skip to content

Commit 431ec31

Browse files
ImanSharaffjl
authored andcommitted
p2p/simulations: escape mockerType value from request (ethereum#24822)
Co-authored-by: Felix Lange <fjl@twurst.com>
1 parent 6119d4f commit 431ec31

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

p2p/simulations/http.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"context"
2323
"encoding/json"
2424
"fmt"
25+
"html"
2526
"io"
2627
"io/ioutil"
2728
"net/http"
@@ -336,7 +337,7 @@ func (s *Server) StartMocker(w http.ResponseWriter, req *http.Request) {
336337
mockerType := req.FormValue("mocker-type")
337338
mockerFn := LookupMocker(mockerType)
338339
if mockerFn == nil {
339-
http.Error(w, fmt.Sprintf("unknown mocker type %q", mockerType), http.StatusBadRequest)
340+
http.Error(w, fmt.Sprintf("unknown mocker type %q", html.EscapeString(mockerType)), http.StatusBadRequest)
340341
return
341342
}
342343
nodeCount, err := strconv.Atoi(req.FormValue("node-count"))

0 commit comments

Comments
 (0)