mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-01 02:37:37 +00:00
log: clone terminal handler attrs (#35141)
Clone the existing terminal handler attrs before appending new attrs. This avoids a potential attr memory overwrite when append reuses the backing array shared with the parent handler.
This commit is contained in:
parent
32986bf084
commit
409aaefac1
1 changed files with 2 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"log/slog"
|
||||
"math/big"
|
||||
"reflect"
|
||||
"slices"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
|
@ -97,7 +98,7 @@ func (h *TerminalHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
|
|||
wr: h.wr,
|
||||
lvl: h.lvl,
|
||||
useColor: h.useColor,
|
||||
attrs: append(h.attrs, attrs...),
|
||||
attrs: append(slices.Clone(h.attrs), attrs...),
|
||||
fieldPadding: make(map[string]int),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue