From 6b4cb93c84e845092ee1a20947f3ffbdecc89fa0 Mon Sep 17 00:00:00 2001 From: dengert Date: Fri, 8 Oct 2010 14:53:29 +0000 Subject: [PATCH] Fix #253 - Allow caller to read a partial object by returning all that was read. Related to #257 which fixed a different path in apdu.c git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4804 c6295689-39f2-0310-b995-f0e70906c6a9 --- src/libopensc/apdu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libopensc/apdu.c b/src/libopensc/apdu.c index 58736ad5..791db38c 100644 --- a/src/libopensc/apdu.c +++ b/src/libopensc/apdu.c @@ -490,7 +490,8 @@ static int do_single_transmit(sc_card_t *card, sc_apdu_t *apdu) SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE, r); if (buflen < le) - return SC_ERROR_WRONG_LENGTH; + /* copy as much as will fit in requested buffer */ + le = buflen; memcpy(buf, tbuf, le); buf += le;