- Timestamp:
- 04/26/06 10:07:18 (3 years ago)
- Files:
-
- 1 modified
-
releases/opensc-0.11.0/src/libopensc/apdu.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
releases/opensc-0.11.0/src/libopensc/apdu.c
r2868 r2911 203 203 return SC_ERROR_MEMORY_FAILURE; 204 204 /* encode the APDU in the buffer */ 205 if (sc_apdu2bytes(ctx, apdu, proto, nbuf, nlen) != SC_SUCCESS) 205 if (sc_apdu2bytes(ctx, apdu, proto, nbuf, nlen) != SC_SUCCESS) { 206 free(nbuf); 206 207 return SC_ERROR_INTERNAL; 208 } 207 209 *buf = nbuf; 208 210 *len = nlen; … … 225 227 len -= 2; 226 228 /* set output length and copy the returned data if necessary */ 227 if ( len <= apdu->resplen)229 if (apdu->resplen >= len) { 228 230 apdu->resplen = len; 229 230 if (apdu->resplen != 0)231 231 memcpy(apdu->resp, buf, apdu->resplen); 232 } 232 233 233 234 return SC_SUCCESS;
