fix apdu length check: 0..3 is wrong (too short). 4 is ok.
5 is not (length byte for data, but no data?). 6 or more is ok (length byte and data). checking for "5" is not important. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3573 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
042d9d06a5
commit
a767600ee8
|
@ -386,9 +386,9 @@ static int cardos_sm4h(unsigned char *in, size_t inlen, unsigned char
|
||||||
|
|
||||||
if (inlen < 4)
|
if (inlen < 4)
|
||||||
return 0; /* failed, apdu too short */
|
return 0; /* failed, apdu too short */
|
||||||
if (inlen == 4)
|
if (inlen <= 5)
|
||||||
plain_lc = 0;
|
plain_lc = 0;
|
||||||
if (inlen > 4)
|
if (inlen > 5)
|
||||||
plain_lc = in[4];
|
plain_lc = in[4];
|
||||||
|
|
||||||
/* 4 + plain_lc plus 0..7 bytes of padding */
|
/* 4 + plain_lc plus 0..7 bytes of padding */
|
||||||
|
|
Loading…
Reference in New Issue