Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit d3e0258

Browse files
committed
db4s: Escape a user supplied string, for safety
1 parent 53405ea commit d3e0258

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

db4s/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"encoding/hex"
99
"encoding/json"
1010
"fmt"
11+
"html"
1112
"io"
1213
"log"
1314
"net/http"
@@ -492,7 +493,7 @@ func licenceAddHandler(w http.ResponseWriter, r *http.Request) {
492493
case "html":
493494
fileFormat = "html"
494495
default:
495-
http.Error(w, fmt.Sprintf("Unknown file format: %s", ff), http.StatusBadRequest)
496+
http.Error(w, fmt.Sprintf("Unknown file format: %s", html.EscapeString(ff)), http.StatusBadRequest)
496497
return
497498
}
498499

0 commit comments

Comments
 (0)