[Spice-devel] [PATCH libcacard] Do not use static buffer to avoid possible races

Frediano Ziglio fziglio at redhat.com
Wed Aug 15 09:30:36 UTC 2018


Using a static writeable buffer and threads could lead to race
conditions (like multiple threads calling the same function).
The fci_template buffer is changed some lines below with a memcpy.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/card_7816.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/card_7816.c b/src/card_7816.c
index 58bdda8..dc12138 100644
--- a/src/card_7816.c
+++ b/src/card_7816.c
@@ -659,7 +659,7 @@ vcard7816_vm_process_apdu(VCard *card, VCardAPDU *apdu,
                 *response = vcard_response_new(card, gp_response,
                     sizeof(gp_response), apdu->a_Le, VCARD7816_STATUS_SUCCESS);
             } else {
-                static unsigned char fci_template[] = {
+                unsigned char fci_template[] = {
                     0x6F, 0x0B, 0x84, 0x07, 0xA0, 0x00, 0x00, 0x00,
                     0x79, 0x03, 0x00, 0xA5, 0x00};
                 /* with GSC-IS 2 applets, we do not need to return anything
-- 
2.17.1



More information about the Spice-devel mailing list