Skip to content

Commit

Permalink
fix: protect Context.Keys map when call Copy method (#3873)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingcanfish authored Mar 11, 2024
1 parent 5f458dd commit 646312a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ func (c *Context) Copy() *Context {

cKeys := c.Keys
cp.Keys = make(map[string]any, len(cKeys))
c.mu.RLock()
for k, v := range cKeys {
cp.Keys[k] = v
}
c.mu.RUnlock()

cParams := c.Params
cp.Params = make([]Param, len(cParams))
Expand Down

0 comments on commit 646312a

Please sign in to comment.