Skip to content

Commit

Permalink
Security.
Browse files Browse the repository at this point in the history
  • Loading branch information
ibiscum committed May 3, 2024
1 parent 5211a5b commit 3dadd15
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Chapter15/Exercise15.03/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"html"
"log"
"net/http"
"strings"
Expand All @@ -18,7 +19,7 @@ func Hello(w http.ResponseWriter, r *http.Request) {
}
return
}
_, err := w.Write([]byte(fmt.Sprintf("Hello %s", strings.Join(name, ","))))
_, err := w.Write([]byte(fmt.Sprintf("Hello %s", html.EscapeString(strings.Join(name, ",")))))
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 3dadd15

Please sign in to comment.