mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
fix: validate closing quote in HexOrDecimal64.UnmarshalJSON
This commit is contained in:
parent
b98b255449
commit
3830fa0c93
1 changed files with 1 additions and 1 deletions
|
|
@ -30,7 +30,7 @@ type HexOrDecimal64 uint64
|
||||||
// It is similar to UnmarshalText, but allows parsing real decimals too, not just
|
// It is similar to UnmarshalText, but allows parsing real decimals too, not just
|
||||||
// quoted decimal strings.
|
// quoted decimal strings.
|
||||||
func (i *HexOrDecimal64) UnmarshalJSON(input []byte) error {
|
func (i *HexOrDecimal64) UnmarshalJSON(input []byte) error {
|
||||||
if len(input) > 1 && input[0] == '"' {
|
if len(input) >= 2 && input[0] == '"' && input[len(input)-1] == '"' {
|
||||||
input = input[1 : len(input)-1]
|
input = input[1 : len(input)-1]
|
||||||
}
|
}
|
||||||
return i.UnmarshalText(input)
|
return i.UnmarshalText(input)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue