From 09cca4bf9a66f7d1c03f93aa4b219d72ca9a3640 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Tue, 11 Dec 2007 07:16:04 +0000 Subject: [PATCH] NULL-terminate all strings coming in over the wire protocol. Should help 2007-12-11 Sven Neumann * libgimpbase/gimpwire.c (_gimp_read_read_string): NULL-terminate all strings coming in over the wire protocol. Should help with bug #498207. svn path=/trunk/; revision=24312 --- ChangeLog | 6 ++++++ libgimpbase/gimpwire.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index e4c15aeb5f..17c78a00ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-12-11 Sven Neumann + + * libgimpbase/gimpwire.c (_gimp_read_read_string): NULL-terminate + all strings coming in over the wire protocol. Should help with bug + #498207. + 2007-12-10 Sven Neumann * plug-ins/pygimp/gimpmodule.c (pygimp_set_background) diff --git a/libgimpbase/gimpwire.c b/libgimpbase/gimpwire.c index 4f073cadce..4bb37c3b2c 100644 --- a/libgimpbase/gimpwire.c +++ b/libgimpbase/gimpwire.c @@ -433,12 +433,16 @@ _gimp_wire_read_string (GIOChannel *channel, if (tmp > 0) { data[i] = g_new (gchar, tmp); + if (! _gimp_wire_read_int8 (channel, (guint8 *) data[i], tmp, user_data)) { g_free (data[i]); return FALSE; } + + /* make sure that the string is NULL-terminated */ + data[i][tmp - 1] = '\0'; } else {