Commit a98e35d7 authored by obscuren's avatar obscuren

Length checking

parent 65722aee
...@@ -90,7 +90,7 @@ func IsHex(str string) bool { ...@@ -90,7 +90,7 @@ func IsHex(str string) bool {
} }
func StringToByteFunc(str string, cb func(str string) []byte) (ret []byte) { func StringToByteFunc(str string, cb func(str string) []byte) (ret []byte) {
if str[0:2] == "0x" { if len(str) > 1 && str[0:2] == "0x" {
ret = FromHex(str[2:]) ret = FromHex(str[2:])
} else { } else {
ret = cb(str) ret = cb(str)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment