[spice-gtk] Avoid to access array with negative numbers

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

 



---
 src/spice-widget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 19753e7..d2fd789 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -1549,7 +1549,7 @@ static int button_gdk_to_spice(int gdk)
         [ 5 ] = SPICE_MOUSE_BUTTON_DOWN,
     };
 
-    if (gdk < SPICE_N_ELEMENTS(map)) {
+    if (gdk >= 0 && gdk < SPICE_N_ELEMENTS(map)) {
         return map [ gdk ];
     }
     return 0;
-- 
2.5.5

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




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