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@xxxxxxxxxx> --- server/smartcard.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/smartcard.c b/server/smartcard.c index 3f51f5298..4c5bba07d 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]; } -- 2.21.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel