- fixed memory corruption on card initialization
- fixed compilation warning git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@340 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -137,9 +137,8 @@ int ccid_initialize(int reader_id, const char *cdriver, int verbose)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof *card_in_slot; i++) {
|
||||
for (i = 0; i < sizeof(card_in_slot)/sizeof(*card_in_slot); i++)
|
||||
card_in_slot[i] = NULL;
|
||||
}
|
||||
|
||||
i = initialize(reader_id, cdriver, verbose, &ctx, &reader);
|
||||
if (i < 0)
|
||||
@@ -1153,7 +1152,8 @@ perform_PC_to_RDR_Secure(const __u8 *in, size_t inlen, __u8** out, size_t *outle
|
||||
sc_result = perform_PC_to_RDR_Secure_GetReadersPACECapabilities(
|
||||
&abDataOut, &abDataOutLen);
|
||||
|
||||
bin_log(card_in_slot[request->bSlot], "PACE Capabilities", abDataOut, abDataOutLen);
|
||||
if (card_in_slot[request->bSlot])
|
||||
bin_log(card_in_slot[request->bSlot]->ctx, "PACE Capabilities", abDataOut, abDataOutLen);
|
||||
|
||||
goto err;
|
||||
break;
|
||||
|
||||
@@ -56,12 +56,12 @@ int initialize(int reader_id, const char *cdriver, int verbose,
|
||||
*reader = sc_ctx_get_reader(*ctx, i);
|
||||
if (sc_detect_card_presence(*reader, 0) & SC_SLOT_CARD_PRESENT) {
|
||||
reader_id = i;
|
||||
sc_debug(*ctx, "Using reader with a card: %s", (*reader)->name);
|
||||
sc_debug(*ctx, "Using the first reader with a card: %s", (*reader)->name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (reader_id >= reader_count) {
|
||||
/* no reader found, use the first */
|
||||
sc_debug(*ctx, "No card found, using the first reader.");
|
||||
reader_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1814,9 +1814,6 @@ main (int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
fprintf (stderr, "serial=\"%s\"\n", serial);
|
||||
|
||||
if (chdir (gadgetfs) < 0) {
|
||||
fprintf (stderr, "Error changing directory to %s\n", gadgetfs);
|
||||
return 1;
|
||||
@@ -1839,6 +1836,9 @@ main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
fprintf (stderr, "serial=\"%s\"\n", doserial ? doserial : serial);
|
||||
|
||||
if (doiintf) {
|
||||
for (i=0; i<sizeof(stringtab)/sizeof(struct usb_string); i++) {
|
||||
if (stringtab[i].id == STRINGID_INTERFACE) {
|
||||
|
||||
Reference in New Issue
Block a user