Add TLS length check
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2022-06-07 01:13:56 +02:00
parent 709e6fa6de
commit 2c7ffa4d5c
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk

View file

@ -237,7 +237,7 @@ func handleHexHash(pathElements []string, ctx httputils.RequestContext, host str
}
func handle(ctx httputils.RequestContext) {
if len(ctx.GetHost()) > 0 && strings.Split(ctx.GetHost(), ":")[0] != ctx.GetTLSServerName() { //Prevents rebinding / DNS stuff
if len(ctx.GetHost()) > 0 && len(ctx.GetTLSServerName()) > 0 && strings.Split(ctx.GetHost(), ":")[0] != ctx.GetTLSServerName() { //Prevents rebinding / DNS stuff
ctx.SetResponseCode(http.StatusNotFound)
return
}