Explorar o código

fix: Patch potential nil pointer deference in proxy::http::client::fillRequestHeader().

cty123 %!s(int64=2) %!d(string=hai) anos
pai
achega
8eb3cfe144
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      proxy/http/client.go

+ 4 - 0
proxy/http/client.go

@@ -172,6 +172,10 @@ func fillRequestHeader(ctx context.Context, header []*Header) ([]*Header, error)
 	inbound := session.InboundFromContext(ctx)
 	inbound := session.InboundFromContext(ctx)
 	outbound := session.OutboundFromContext(ctx)
 	outbound := session.OutboundFromContext(ctx)
 
 
+	if inbound == nil || outbound == nil {
+		return nil, newError("missing inbound or outbound metadata from context")
+	}
+
 	data := struct {
 	data := struct {
 		Source net.Destination
 		Source net.Destination
 		Target net.Destination
 		Target net.Destination