mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-11 11:37:03 +02:00
db: fix slice aliasing in migration tag merge
The migration at db.go:680 appends validated tags to existing tags using append(existingTags, validatedTags...) where existingTags aliases node.Tags. When node.Tags has spare capacity, append writes into the shared backing array, and the subsequent slices.Sort corrupts the original. Clone existingTags before appending to prevent aliasing.
This commit is contained in:
committed by
Kristoffer Dalby
parent
82bb4331f5
commit
3037e5eee0
@@ -677,7 +677,7 @@ AND auth_key_id NOT IN (
|
||||
continue
|
||||
}
|
||||
|
||||
mergedTags := append(existingTags, validatedTags...)
|
||||
mergedTags := append(slices.Clone(existingTags), validatedTags...)
|
||||
slices.Sort(mergedTags)
|
||||
mergedTags = slices.Compact(mergedTags)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user