[Spice-commits] 2 commits - server/smartcard.c server/smartcard-channel-client.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 9 07:54:24 UTC 2019


 server/smartcard-channel-client.c |    3 ++-
 server/smartcard.c                |    4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 57d02c2d1752e1726d544723bdb896c38064809f
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Oct 8 12:43:53 2019 +0100

    smartcard: Do not crash if reader_id is invalid
    
    Avoid client to trigger crash. The value of smartcard_readers_get
    is checked for NULL so returning it it's not an issue.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/server/smartcard.c b/server/smartcard.c
index 3f51f529..4c5bba07 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -222,7 +222,9 @@ static int smartcard_char_device_add_to_readers(RedsState *reds, SpiceCharDevice
 
 SpiceCharDeviceInstance *smartcard_readers_get(uint32_t reader_id)
 {
-    spice_assert(reader_id < g_smartcard_readers.num);
+    if (reader_id >= g_smartcard_readers.num) {
+        return NULL;
+    }
     return g_smartcard_readers.sin[reader_id];
 }
 
commit 18877d1af8c8a9e63b34c0994507d7f0227030e6
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Oct 8 12:43:07 2019 +0100

    smartcard-channel-client: Use log instead of printf
    
    More coherent. Also it's not good for a library to output on
    standard output.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/server/smartcard-channel-client.c b/server/smartcard-channel-client.c
index d47b442e..43df902f 100644
--- a/server/smartcard-channel-client.c
+++ b/server/smartcard-channel-client.c
@@ -276,7 +276,8 @@ bool smartcard_channel_client_handle_message(RedChannelClient *rcc,
         case VSC_APDU:
             break; // passed on to device
         default:
-            printf("ERROR: unexpected message on smartcard channel\n");
+            red_channel_warning(red_channel_client_get_channel(rcc),
+                                "ERROR: unexpected message on smartcard channel");
             return TRUE;
     }
 


More information about the Spice-commits mailing list