[epiphany] ephy-profile-migration.c: fix crash when importing some profiles



commit f433ee264428a8289aa6f6ea45e1efd317a39e87
Author: Xan Lopez <xan gnome org>
Date:   Thu Sep 10 12:54:27 2009 +0300

    ephy-profile-migration.c: fix crash when importing some profiles
    
    Be more careful about not going over the end of the lines array.
    
    Bug #594717

 src/ephy-profile-migration.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/ephy-profile-migration.c b/src/ephy-profile-migration.c
index 3acf606..8308915 100644
--- a/src/ephy-profile-migration.c
+++ b/src/ephy-profile-migration.c
@@ -152,6 +152,7 @@ parse_and_decrypt_signons (const char *signons)
   int version;
   gchar **lines;
   int i;
+  guint length;
 
   lines = g_strsplit (signons, "\r\n", -1);
   if (!g_ascii_strncasecmp (lines[0], "#2c", 3))
@@ -175,7 +176,9 @@ parse_and_decrypt_signons (const char *signons)
    * separated by lines that only contain a dot. We find a block by
    * the separator and parse them one by one.
    */
-  while (lines[i]) {
+  length = g_strv_length (lines);
+
+  while (i < length) {
     size_t begin = i;
     size_t end = i + 1;
     const char *realmBracketBegin = " (";
@@ -268,7 +271,7 @@ parse_and_decrypt_signons (const char *signons)
       if (version >= 2) {
         if (begin < end)
           /* Skip it */ ;
-        begin ++;
+        begin++;
 
         /* Version 3 has an extra line for further use */
         if (version == 3)



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