gdesktopappinfo: fix a crasher
authorRyan Lortie <desrt@desrt.ca>
Tue, 15 Apr 2014 18:10:39 +0000 (14:10 -0400)
committerRyan Lortie <desrt@desrt.ca>
Tue, 15 Apr 2014 18:12:58 +0000 (14:12 -0400)
During the time that we are expanding the strv, it is not
null-terminated.  Use the strv_len variable instead to bound the search
for duplicates.

gio/gdesktopappinfo.c

index 8d1bc69..0b72803 100644 (file)
@@ -663,7 +663,7 @@ expand_strv (gchar         ***strv_ptr,
             goto no_add;
 
       /* Don't add duplicates already in the list */
-      for (j = 0; strv[j]; j++)
+      for (j = 0; j < strv_len; j++)
         if (g_str_equal (to_add[i], strv[j]))
           goto no_add;