changeset 2234:3e38b1e90480

PR icedtea/474: Commit patch from Paulo Cesar Pereira de Andrade, incrementing malloc size to account for NULL terminator. 2010-04-20 Deepak Bhole <dbhole@redhat.com> PR icedtea/474 * plugin/icedteanp/IcedTeaNPPlugin.cc (plugin_filter_environment): Increment malloc size by one to account for NULL terminator. Bug# 474.
author Deepak Bhole <dbhole@redhat.com>
date Tue, 20 Apr 2010 16:11:05 -0400
parents 47b2ef04fed4
children e32c0b73290f
files ChangeLog plugin/icedteanp/IcedTeaNPPlugin.cc
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Apr 19 16:50:36 2010 +0200
+++ b/ChangeLog	Tue Apr 20 16:11:05 2010 -0400
@@ -1,3 +1,10 @@
+2010-04-20  Deepak Bhole <dbhole@redhat.com>
+
+	PR icedtea/474
+	* plugin/icedteanp/IcedTeaNPPlugin.cc
+	(plugin_filter_environment): Increment malloc size by one to account for
+	NULL terminator. Bug# 474.
+
 2010-04-19  Xerxes RĂ„nby  <xerxes@zafena.se>
 
 	* ports/hotspot/src/share/vm/shark/sharkBuilder.cpp
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Mon Apr 19 16:50:36 2010 +0200
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Tue Apr 20 16:11:05 2010 -0400
@@ -1464,7 +1464,7 @@
 plugin_filter_environment(void)
 {
   gchar **var_names = g_listenv();
-  gchar **new_env = (gchar**) malloc(sizeof(gchar*) * g_strv_length (var_names));
+  gchar **new_env = (gchar**) malloc(sizeof(gchar*) * g_strv_length (var_names) + 1);
   int i_var, i_env;
 
   for (i_var = 0, i_env = 0; var_names[i_var] != NULL; i_var++)