Ignore anomalous environment entries which are not of the form

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)
This commit is contained in:
Matthias Clasen
2005-07-10 04:44:27 +00:00
committed by Matthias Clasen
parent 3baeda095b
commit 35425ca9d6
5 changed files with 29 additions and 3 deletions

View 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> 2005-07-09 Tor Lillqvist <tml@novell.com>
* glib/giowin32.c: Totally rewritten socket channel * glib/giowin32.c: Totally rewritten socket channel

View 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> 2005-07-09 Tor Lillqvist <tml@novell.com>
* glib/giowin32.c: Totally rewritten socket channel * glib/giowin32.c: Totally rewritten socket channel

View 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> 2005-07-09 Tor Lillqvist <tml@novell.com>
* glib/giowin32.c: Totally rewritten socket channel * glib/giowin32.c: Totally rewritten socket channel

View 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> 2005-07-09 Tor Lillqvist <tml@novell.com>
* glib/giowin32.c: Totally rewritten socket channel * glib/giowin32.c: Totally rewritten socket channel

View File

@@ -1341,18 +1341,20 @@ gchar **
g_listenv (void) g_listenv (void)
{ {
gchar **result, *eq; gchar **result, *eq;
gint len, i; gint len, i, j;
len = g_strv_length (environ); len = g_strv_length (environ);
result = g_new0 (gchar *, len + 1); result = g_new0 (gchar *, len + 1);
j = 0;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
eq = strchr (environ[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; return result;
} }