Skip to content

Commit

Permalink
p2p/simulations: escape mockerType value from request (#24822)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix Lange <fjl@twurst.com>
  • Loading branch information
ImanSharaf and fjl committed May 5, 2022
1 parent 256aae0 commit ca8e2f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion p2p/simulations/http.go
Expand Up @@ -22,6 +22,7 @@ import (
"context"
"encoding/json"
"fmt"
"html"
"io"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -336,7 +337,7 @@ func (s *Server) StartMocker(w http.ResponseWriter, req *http.Request) {
mockerType := req.FormValue("mocker-type")
mockerFn := LookupMocker(mockerType)
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
}
nodeCount, err := strconv.Atoi(req.FormValue("node-count"))
Expand Down

0 comments on commit ca8e2f1

Please sign in to comment.