Skip to content

Commit

Permalink
fix: copy bytes in mapModel.Scan (#1030)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnonce committed Oct 17, 2024
1 parent f8e0d5e commit d1193a5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion model_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ func (m *mapModel) Scan(src interface{}) error {
return m.scanRaw(src)
case reflect.Slice:
if scanType.Elem().Kind() == reflect.Uint8 {
return m.scanRaw(src)
srcB := src.([]byte)
src2 := make([]byte, len(srcB))
copy(src2, srcB)

return m.scanRaw(src2)
}
}

Expand Down

0 comments on commit d1193a5

Please sign in to comment.