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