mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-08 14:13:22 +00:00
Loopback outbound: Avoid directly modifying potential shared ctx (#5960)
Fixes https://github.com/XTLS/Xray-core/issues/5958
This commit is contained in:
@@ -45,9 +45,11 @@ func (l *Loopback) Process(ctx context.Context, link *transport.Link, _ internet
|
|||||||
|
|
||||||
ctx = session.ContextWithContent(ctx, content)
|
ctx = session.ContextWithContent(ctx, content)
|
||||||
|
|
||||||
inbound := session.InboundFromContext(ctx)
|
inbound := &session.Inbound{}
|
||||||
if inbound == nil {
|
originInbound := session.InboundFromContext(ctx)
|
||||||
inbound = &session.Inbound{}
|
if originInbound != nil {
|
||||||
|
// get a shallow copy to avoid modifying the inbound tag in upstream context
|
||||||
|
*inbound = *originInbound
|
||||||
}
|
}
|
||||||
|
|
||||||
inbound.Tag = l.config.InboundTag
|
inbound.Tag = l.config.InboundTag
|
||||||
|
|||||||
Reference in New Issue
Block a user