Merge pull request #2114 from jennifersp/master

add byte length check to uint32
pull/2102/merge
Jack Christensen 2024-08-26 07:28:47 -05:00 committed by GitHub
commit e9bd382c51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -296,6 +296,10 @@ func (scanPlanBinaryUint32ToTextScanner) Scan(src []byte, dst any) error {
return s.ScanText(Text{})
}
if len(src) != 4 {
return fmt.Errorf("invalid length for uint32: %v", len(src))
}
n := uint64(binary.BigEndian.Uint32(src))
return s.ScanText(Text{String: strconv.FormatUint(n, 10), Valid: true})
}