[eog] EogWindow: Fix bounds check in OpenWith action callback



commit e7f545175f73f2d4ac4a8e1f748045c57bd69162
Author: Felix Riemann <friemann gnome org>
Date:   Sat Oct 8 22:48:54 2016 +0200

    EogWindow: Fix bounds check in OpenWith action callback
    
    The previous check would let any index pass.

 src/eog-window.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/eog-window.c b/src/eog-window.c
index e6bc460..f75aad8 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -1017,14 +1017,14 @@ eog_window_action_open_with (GSimpleAction *action,
        GAppInfo *app;
        GFile *file;
        GList *files = NULL;
-       guint32 index = -1;
+       guint32 index = G_MAXUINT32;
 
 
        g_return_if_fail (EOG_IS_WINDOW (user_data));
        window = EOG_WINDOW (user_data);
 
        index = g_variant_get_uint32 (parameter);
-       if (index < 0)
+       if (G_UNLIKELY (index >= window->priv->appinfo->len))
                return;
 
        app = g_ptr_array_index (window->priv->appinfo, index);


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