[hotssh] hostdb: Fix iteration overrun



commit 0ca4b172254afc38b0f3d31ff4cb0e46e4a97005
Author: Colin Walters <walters verbum org>
Date:   Mon Dec 2 14:43:18 2013 -0500

    hostdb: Fix iteration overrun

 src/hotssh-hostdb.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/hotssh-hostdb.c b/src/hotssh-hostdb.c
index 0473131..82aaaa0 100644
--- a/src/hotssh-hostdb.c
+++ b/src/hotssh-hostdb.c
@@ -320,13 +320,11 @@ hostname_to_iter (HotSshHostDB    *self,
                           HOTSSH_HOSTDB_COLUMN_HOSTNAME, &model_hostname,
                           -1);
 
-      if (g_ascii_strcasecmp (hostname, model_hostname) != 0)
-        {
-          gtk_tree_model_iter_next ((GtkTreeModel*)priv->model, iter);
-          continue;
-        }
+      if (g_ascii_strcasecmp (hostname, model_hostname) == 0)
+        return TRUE;
 
-      return TRUE;
+      if (!gtk_tree_model_iter_next ((GtkTreeModel*)priv->model, iter))
+        break;
     }
 
   return FALSE;


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