Closed mike76-dev closed 1 month ago
The panic happens in hex.Decode if the submitted public key cannot fit in 32 bytes. Should return an error instead.
hex.Decode
func unmarshalHex(dst []byte, prefix string, data []byte) error { n, err := hex.Decode(dst, bytes.TrimPrefix(data, []byte(prefix+":"))) if n < len(dst) { err = io.ErrUnexpectedEOF } if err != nil { return fmt.Errorf("decoding %v:<hex> failed: %w", prefix, err) } return nil }
Good catch!
The panic happens in
hex.Decode
if the submitted public key cannot fit in 32 bytes. Should return an error instead.