Skip to content

Commit e9bd382

Browse files
authored
Merge pull request #2114 from jennifersp/master
add byte length check to uint32
2 parents 603f233 + 73bbced commit e9bd382

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)