Browse Source

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

cty123 2 years ago
parent
commit
8eb3cfe144
1 changed files with 4 additions and 0 deletions
  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)
 	outbound := session.OutboundFromContext(ctx)
 
+	if inbound == nil || outbound == nil {
+		return nil, newError("missing inbound or outbound metadata from context")
+	}
+
 	data := struct {
 		Source net.Destination
 		Target net.Destination