Skip to content

Commit 73bbced

Browse files
committedAug 23, 2024
add byte length check to uint32
1 parent b197994 commit 73bbced

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎pgtype/uint32.go

+4
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ func (scanPlanBinaryUint32ToTextScanner) Scan(src []byte, dst any) error {
296296
return s.ScanText(Text{})
297297
}
298298

299+
if len(src) != 4 {
300+
return fmt.Errorf("invalid length for uint32: %v", len(src))
301+
}
302+
299303
n := uint64(binary.BigEndian.Uint32(src))
300304
return s.ScanText(Text{String: strconv.FormatUint(n, 10), Valid: true})
301305
}

0 commit comments

Comments
 (0)