use g_try_new() so a plug-in can't easily crash the core by sending an

2007-12-11  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimpwire.c (_gimp_wire_read_string): use g_try_new()
	so a plug-in can't easily crash the core by sending an invalid
	string message.

svn path=/trunk/; revision=24316
This commit is contained in:
Sven Neumann 2007-12-11 09:36:38 +00:00 committed by Sven Neumann
parent 18db691f0e
commit a23029a05f
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2007-12-11 Sven Neumann <sven@gimp.org>
* libgimpbase/gimpwire.c (_gimp_wire_read_string): use g_try_new()
so a plug-in can't easily crash the core by sending an invalid
string message.
2007-12-11 Sven Neumann <sven@gimp.org>
* libgimpbase/gimpwire.c (gimp_wire_register): allocate

View File

@ -432,7 +432,13 @@ _gimp_wire_read_string (GIOChannel *channel,
if (tmp > 0)
{
data[i] = g_new (gchar, tmp);
data[i] = g_try_new (gchar, tmp);
if (! data[i])
{
g_printerr ("%s: failed to allocate %u bytes\n", G_STRFUNC, tmp);
return FALSE;
}
if (! _gimp_wire_read_int8 (channel,
(guint8 *) data[i], tmp, user_data))