mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-04-09 11:27:31 +00:00
p2p/simulations: escape mockerType value from request (#24822)
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
parent
256aae0bfa
commit
ca8e2f1ecf
1 changed files with 2 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
@ -336,7 +337,7 @@ func (s *Server) StartMocker(w http.ResponseWriter, req *http.Request) {
|
||||||
mockerType := req.FormValue("mocker-type")
|
mockerType := req.FormValue("mocker-type")
|
||||||
mockerFn := LookupMocker(mockerType)
|
mockerFn := LookupMocker(mockerType)
|
||||||
if mockerFn == nil {
|
if mockerFn == nil {
|
||||||
http.Error(w, fmt.Sprintf("unknown mocker type %q", mockerType), http.StatusBadRequest)
|
http.Error(w, fmt.Sprintf("unknown mocker type %q", html.EscapeString(mockerType)), http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
nodeCount, err := strconv.Atoi(req.FormValue("node-count"))
|
nodeCount, err := strconv.Atoi(req.FormValue("node-count"))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue