restrict parse fil string length (#4780)

This commit is contained in:
Lucas Molas 2020-11-09 22:12:32 -03:00 committed by GitHub
parent 95d9084899
commit 3ec25cbece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,6 +61,10 @@ func ParseFIL(s string) (FIL, error) {
}
}
if len(s) > 50 {
return FIL{}, fmt.Errorf("string length too large: %d", len(s))
}
r, ok := new(big.Rat).SetString(s)
if !ok {
return FIL{}, fmt.Errorf("failed to parse %q as a decimal number", s)