浏览代码

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

cty123 2 年之前
父节点
当前提交
8eb3cfe144
共有 1 个文件被更改,包括 4 次插入0 次删除
  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