forked from cerc-io/plugeth
More review feedback
This commit is contained in:
parent
fc3000d649
commit
6f21520a82
@ -19,6 +19,7 @@ package scwallet
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// commandAPDU represents an application data unit sent to a smartcard.
|
// commandAPDU represents an application data unit sent to a smartcard.
|
||||||
@ -66,6 +67,10 @@ type responseAPDU struct {
|
|||||||
|
|
||||||
// deserialize deserializes a response APDU.
|
// deserialize deserializes a response APDU.
|
||||||
func (ra *responseAPDU) deserialize(data []byte) error {
|
func (ra *responseAPDU) deserialize(data []byte) error {
|
||||||
|
if len(data) < 2 {
|
||||||
|
return fmt.Errorf("can not deserialize data: payload too short (%d < 2)", len(data))
|
||||||
|
}
|
||||||
|
|
||||||
ra.Data = make([]byte, len(data)-2)
|
ra.Data = make([]byte, len(data)-2)
|
||||||
|
|
||||||
buf := bytes.NewReader(data)
|
buf := bytes.NewReader(data)
|
||||||
|
Loading…
Reference in New Issue
Block a user