[at-spi2-core] Fix crash if GetChildAtIndex is called with an invalid index
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core] Fix crash if GetChildAtIndex is called with an invalid index
- Date: Mon, 31 May 2010 16:25:10 +0000 (UTC)
commit db7aeabe87378e343c9e1fff5503b4f1d239ad6d
Author: Mike Gorse <mgorse novell com>
Date: Mon May 31 12:24:58 2010 -0400
Fix crash if GetChildAtIndex is called with an invalid index
registryd/registry.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/registryd/registry.c b/registryd/registry.c
index f3728f8..8391971 100644
--- a/registryd/registry.c
+++ b/registryd/registry.c
@@ -494,8 +494,13 @@ impl_GetChildAtIndex (DBusConnection * bus,
reply = dbus_message_new_method_return (message);
dbus_message_iter_init_append (reply, &iter);
- ref = g_ptr_array_index (reg->apps, i);
- append_reference (&iter, ref->name, ref->path);
+ if (i < 0 || i >= reg->apps->len)
+ append_reference (&iter, SPI_DBUS_NAME_REGISTRY, SPI_DBUS_PATH_NULL);
+ else
+ {
+ ref = g_ptr_array_index (reg->apps, i);
+ append_reference (&iter, ref->name, ref->path);
+ }
return reply;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]