Ignore anomalous environment entries which are not of the form
authorMatthias Clasen <mclasen@redhat.com>
Sun, 10 Jul 2005 04:44:27 +0000 (04:44 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 10 Jul 2005 04:44:27 +0000 (04:44 +0000)
2005-07-10  Matthias Clasen  <mclasen@redhat.com>

* glib/gutils.c (g_listenv): Ignore anomalous environment
entries which are not of the form variable=value.  (#309859,
Morten Welinder)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-8
glib/gutils.c

index b8e95e1..d6cf06f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-07-10  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/gutils.c (g_listenv): Ignore anomalous environment
+       entries which are not of the form variable=value.  (#309859,
+       Morten Welinder)
+
 2005-07-09  Tor Lillqvist  <tml@novell.com>
 
        * glib/giowin32.c: Totally rewritten socket channel
index b8e95e1..d6cf06f 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-10  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/gutils.c (g_listenv): Ignore anomalous environment
+       entries which are not of the form variable=value.  (#309859,
+       Morten Welinder)
+
 2005-07-09  Tor Lillqvist  <tml@novell.com>
 
        * glib/giowin32.c: Totally rewritten socket channel
index b8e95e1..d6cf06f 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-10  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/gutils.c (g_listenv): Ignore anomalous environment
+       entries which are not of the form variable=value.  (#309859,
+       Morten Welinder)
+
 2005-07-09  Tor Lillqvist  <tml@novell.com>
 
        * glib/giowin32.c: Totally rewritten socket channel
index b8e95e1..d6cf06f 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-10  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/gutils.c (g_listenv): Ignore anomalous environment
+       entries which are not of the form variable=value.  (#309859,
+       Morten Welinder)
+
 2005-07-09  Tor Lillqvist  <tml@novell.com>
 
        * glib/giowin32.c: Totally rewritten socket channel
index ffa8968..e59f280 100644 (file)
@@ -1341,18 +1341,20 @@ gchar **
 g_listenv (void)
 {
   gchar **result, *eq;
-  gint len, i;
+  gint len, i, j;
 
   len = g_strv_length (environ);
   result = g_new0 (gchar *, len + 1);
   
+  j = 0;
   for (i = 0; i < len; i++)
     {
       eq = strchr (environ[i], '=');
-      result[i] = g_strndup (environ[i], eq - environ[i]);
+      if (eq)
+       result[j++] = g_strndup (environ[i], eq - environ[i]);
     }
 
-  result[len] = NULL;
+  result[j] = NULL;
 
   return result;
 }