From d1193a502e17bd62b331e78b89f2805ddaf0aff9 Mon Sep 17 00:00:00 2001 From: bnonce Date: Thu, 17 Oct 2024 12:07:15 +0300 Subject: [PATCH] fix: copy bytes in mapModel.Scan (#1030) --- model_map.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/model_map.go b/model_map.go index 814d636e6..99a5192a3 100644 --- a/model_map.go +++ b/model_map.go @@ -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) } }