[Spice-devel] [cacard 4/5] aca: Fix off-by-one error when iterating over applets_table

Christophe Fergeau cfergeau at redhat.com
Tue Aug 21 15:07:38 UTC 2018


It has elements from 0 to num_applets-1, and we were using elements from
0 to num_applets when iterating in cac_aca_get_applet_acr_coid()

Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
 src/cac-aca.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cac-aca.c b/src/cac-aca.c
index 3e1cb35..778772e 100644
--- a/src/cac-aca.c
+++ b/src/cac-aca.c
@@ -806,7 +806,7 @@ cac_aca_get_applet_acr_coid(unsigned int pki_applets, unsigned char *coid)
 
     r = g_malloc(sizeof(struct simpletlv_member));
 
-    for (i = 0; i <= applets_table.num_applets; i++) {
+    for (i = 0; i < applets_table.num_applets; i++) {
         /* Skip unused PKI applets */
         if (i >= pki_applets && i < 10)
             continue;
-- 
2.17.1



More information about the Spice-devel mailing list