From c4e4ea0f528d83a5a98249a54d8e3f6024905548 Mon Sep 17 00:00:00 2001 From: phga Date: Wed, 2 Jun 2021 15:57:06 +0200 Subject: [PATCH] fix: also check if correct url parameters have been used --- cmd/dd/dd.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/dd/dd.go b/cmd/dd/dd.go index 01ae813..0c6a7a9 100644 --- a/cmd/dd/dd.go +++ b/cmd/dd/dd.go @@ -10,7 +10,7 @@ import ( "strings" ) -// https://dd.phga.de/dd?usr=&pw= +// https://dd.phga.de/dd?usr=&pwd= func main() { // cheap routing http.HandleFunc("/dd", handleDynamicUpdate) @@ -30,7 +30,7 @@ func handleDynamicUpdate(w http.ResponseWriter, r *http.Request) { ip = strings.Split(r.RemoteAddr, ":")[0] } - if len(up) != 2 { + if len(up) != 2 || len(up["usr"]) != 1 || len(up["pwd"]) != 1 { log.Println("Attempted update for:", ip) log.Println("Not enough arguments provided:", up) return