[gnome-software/wip/rancell/ubuntu-ratings] fwupd: Fix a possible array out of bounds after download fails



commit 2623057f75b51439f1ddcdff0b2608538edf2a30
Author: Kalev Lember <klember redhat com>
Date:   Mon Oct 19 13:45:53 2015 +0200

    fwupd: Fix a possible array out of bounds after download fails
    
    Be more careful when removing items while iterating over the array, so
    that we don't go out of bounds due to the array size change after the
    current item is removed.

 src/plugins/gs-plugin-fwupd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 9f20d68..5324b87 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -783,7 +783,7 @@ gs_plugin_refresh (GsPlugin *plugin,
                if (status_code != SOUP_STATUS_OK) {
                        g_warning ("Failed to download %s, ignoring: %s",
                                   tmp, soup_status_get_phrase (status_code));
-                       g_ptr_array_remove (plugin->priv->to_download, (gpointer) tmp);
+                       g_ptr_array_remove_index (plugin->priv->to_download, i--);
                        g_ptr_array_add (plugin->priv->to_ignore, g_strdup (tmp));
                        continue;
                }


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