scd: Fix receive buffer size.

* scd/apdu.c (send_le): Fix the size, adding two for status
bytes to Le.

--
Backport of master commit: 5c2db9dedf

This is long standing bug.  So far, Le was not exact value.
Since forthcoming change will introduce exact value of expected length
of response data, this change is needed.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2016-11-22 20:53:57 +09:00
parent 3089c76a4a
commit bb5a153f9d
1 changed files with 3 additions and 2 deletions

View File

@ -3648,8 +3648,9 @@ send_le (int slot, int class, int ins, int p0, int p1,
if (use_extended_length && (le > 256 || le < 0))
{
result_buffer_size = le < 0? 4096 : le;
result_buffer = xtrymalloc (result_buffer_size + 10);
/* Two more bytes are needed for status bytes. */
result_buffer_size = le < 0? 4096 : (le + 2);
result_buffer = xtrymalloc (result_buffer_size);
if (!result_buffer)
{
xfree (apdu_buffer);