|
|
da5cc8 |
diff --git a/src/cac-aca.c b/src/cac-aca.c
|
|
|
da5cc8 |
index 9e305a8..e66b089 100644
|
|
|
da5cc8 |
--- a/src/cac-aca.c
|
|
|
da5cc8 |
+++ b/src/cac-aca.c
|
|
|
da5cc8 |
@@ -60,7 +60,7 @@ struct acr_entry {
|
|
|
da5cc8 |
struct acr_access_method access_methods[MAX_ACCESS_METHODS];
|
|
|
da5cc8 |
};
|
|
|
da5cc8 |
struct acr_table {
|
|
|
da5cc8 |
- unsigned int num_entries;
|
|
|
da5cc8 |
+ unsigned char num_entries;
|
|
|
da5cc8 |
struct acr_entry entries[];
|
|
|
da5cc8 |
};
|
|
|
da5cc8 |
|
|
|
da5cc8 |
diff --git a/tests/libcacard.c b/tests/libcacard.c
|
|
|
da5cc8 |
index 0c6cca1..18ccf6f 100644
|
|
|
da5cc8 |
--- a/tests/libcacard.c
|
|
|
da5cc8 |
+++ b/tests/libcacard.c
|
|
|
da5cc8 |
@@ -179,7 +179,7 @@ static void parse_acr(uint8_t *buf, int buflen)
|
|
|
da5cc8 |
{
|
|
|
da5cc8 |
uint8_t *p, *p_end;
|
|
|
da5cc8 |
int have_applet_information = 0;
|
|
|
da5cc8 |
- int num_entries = 0, num_entries_expected = -1;
|
|
|
da5cc8 |
+ uint8_t num_entries = 0, num_entries_expected = 255;
|
|
|
da5cc8 |
|
|
|
da5cc8 |
p = buf;
|
|
|
da5cc8 |
p_end = p + buflen - 2;
|
|
|
da5cc8 |
@@ -204,7 +204,7 @@ static void parse_acr(uint8_t *buf, int buflen)
|
|
|
da5cc8 |
case 0x81: /* Num Applet/Objects */
|
|
|
da5cc8 |
case 0x91: /* Num AMP Entries */
|
|
|
da5cc8 |
case 0x94: /* Num Service Applet Entries */
|
|
|
da5cc8 |
- g_assert_cmpint(num_entries_expected, ==, -1);
|
|
|
da5cc8 |
+ g_assert_cmpint(num_entries_expected, ==, 255);
|
|
|
da5cc8 |
g_assert_cmpint(num_entries, ==, 0);
|
|
|
da5cc8 |
num_entries_expected = *p;
|
|
|
da5cc8 |
break;
|
|
|
da5cc8 |
@@ -230,7 +230,7 @@ static void parse_acr(uint8_t *buf, int buflen)
|
|
|
da5cc8 |
/* Every response needs to have exactly one applet information tag */
|
|
|
da5cc8 |
g_assert_cmpint(have_applet_information, ==, 1);
|
|
|
da5cc8 |
/* The number of entries in the second tag matches the number of entries later */
|
|
|
da5cc8 |
- if (num_entries_expected != -1) {
|
|
|
da5cc8 |
+ if (num_entries_expected != 255) {
|
|
|
da5cc8 |
g_assert_cmpint(num_entries, ==, num_entries_expected);
|
|
|
da5cc8 |
}
|
|
|
da5cc8 |
/* nothing left to read */
|