From cbc3a858c8e6e5688628477e1522723ef4663238 Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Fri, 26 Dec 2008 18:38:37 +0000 Subject: [PATCH] Fix an array overflow which led to an assertion crash. Reported by: miwi Obtained from: http://bugzilla.openedhand.com/show_bug.cgi?id=1203 --- devel/json-glib/Makefile | 1 + .../files/patch-json-glib_json-object.c | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 devel/json-glib/files/patch-json-glib_json-object.c diff --git a/devel/json-glib/Makefile b/devel/json-glib/Makefile index 6e25e37c2c47..49c5484dbdac 100644 --- a/devel/json-glib/Makefile +++ b/devel/json-glib/Makefile @@ -7,6 +7,7 @@ PORTNAME= json-glib PORTVERSION= 0.6.2 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= http://folks.o-hand.com/~ebassi/sources/ diff --git a/devel/json-glib/files/patch-json-glib_json-object.c b/devel/json-glib/files/patch-json-glib_json-object.c new file mode 100644 index 000000000000..b01ae9261354 --- /dev/null +++ b/devel/json-glib/files/patch-json-glib_json-object.c @@ -0,0 +1,21 @@ +diff --git a/json-glib/json-gobject.c b/json-glib/json-gobject.c +index 15e9ed5..eeb571c 100644 +--- json-glib/json-gobject.c ++++ json-glib/json-gobject.c +@@ -189,7 +189,7 @@ json_deserialize_pspec (GValue *value, + { + JsonArray *array = json_node_get_array (node); + guint i, array_len = json_array_get_length (array); +- GPtrArray *str_array = g_ptr_array_sized_new (array_len); ++ GPtrArray *str_array = g_ptr_array_sized_new (array_len + 1); + + for (i = 0; i < array_len; i++) + { +@@ -201,6 +201,7 @@ json_deserialize_pspec (GValue *value, + if (json_node_get_string (val) != NULL); + g_ptr_array_add (str_array, (gpointer) json_node_get_string (val)); + } ++ g_ptr_array_add (str_array, NULL); + + g_value_set_boxed (value, str_array->pdata); +