Re: [PATCH] Do not use static buffer to avoid possible races

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Good catch, and the buffer is small enough that it's not a big deal if
it's not static, and the data it contains is copied in this same block,
so we don't need the buffer to stay alive for a prolonged time.

Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>


On Tue, Aug 14, 2018 at 10:35:56AM +0100, Frediano Ziglio wrote:
> 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@xxxxxxxxxx>
> ---
>  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
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]