Skip to content

Commit 646312a

Browse files
authored
fix: protect Context.Keys map when call Copy method (#3873)
1 parent 5f458dd commit 646312a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

context.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ func (c *Context) Copy() *Context {
124124

125125
cKeys := c.Keys
126126
cp.Keys = make(map[string]any, len(cKeys))
127+
c.mu.RLock()
127128
for k, v := range cKeys {
128129
cp.Keys[k] = v
129130
}
131+
c.mu.RUnlock()
130132

131133
cParams := c.Params
132134
cp.Params = make([]Param, len(cParams))

0 commit comments

Comments
 (0)