]> Cypherpunks repositories - gostls13.git/commitdiff
net/http/pprof: don't treat os.Args as format string in Cmdline handler
authorBrad Fitzpatrick <bradfitz@golang.org>
Mon, 14 Dec 2020 20:09:17 +0000 (12:09 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 14 Dec 2020 22:28:10 +0000 (22:28 +0000)
Found by @josharian running staticcheck against a fork of this code
elsewhere.

Change-Id: Ica8bae5df71adde1a71e541dd55b0b81b97b3baf
Reviewed-on: https://go-review.googlesource.com/c/go/+/277992
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>

src/net/http/pprof/pprof.go

index 2bfcfb95459633d0805215db38dd72a26f301c56..5389a388c17de3dd2c7dc9b4263c6c49942ec87b 100644 (file)
@@ -91,7 +91,7 @@ func init() {
 func Cmdline(w http.ResponseWriter, r *http.Request) {
        w.Header().Set("X-Content-Type-Options", "nosniff")
        w.Header().Set("Content-Type", "text/plain; charset=utf-8")
-       fmt.Fprintf(w, strings.Join(os.Args, "\x00"))
+       fmt.Fprint(w, strings.Join(os.Args, "\x00"))
 }
 
 func sleep(r *http.Request, d time.Duration) {