[at-spi2-atk] Do not pass unset variables to emit_event()
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-atk] Do not pass unset variables to emit_event()
- Date: Thu, 17 May 2018 14:04:06 +0000 (UTC)
commit 5105a8a19596b0b58746a2e5b268e3d068a94df7
Author: Emmanuele Bassi <ebassi gnome org>
Date: Fri Apr 27 11:26:44 2018 +0100
Do not pass unset variables to emit_event()
Uninitialized variables in C have undefined content; some compilers,
with some debugging flags, may decide to set them to 0, but you cannot
ever rely on that.
If the text variable is unset the validation when appending it to the
message payload may still pass, and we may end up sending random junk
over the wire — or, segfault.
atk-adaptor/event.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/atk-adaptor/event.c b/atk-adaptor/event.c
index f9697ae..b568da3 100644
--- a/atk-adaptor/event.c
+++ b/atk-adaptor/event.c
@@ -944,6 +944,8 @@ text_insert_event_listener (GSignalInvocationHint * signal_hint,
if (G_VALUE_TYPE (¶m_values[3]) == G_TYPE_STRING)
text = g_value_get_string (¶m_values[3]);
+ else
+ text = "";
emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
DBUS_TYPE_STRING_AS_STRING, text, append_basic);
@@ -993,6 +995,8 @@ text_remove_event_listener (GSignalInvocationHint * signal_hint,
if (G_VALUE_TYPE (¶m_values[3]) == G_TYPE_STRING)
text = g_value_get_string (¶m_values[3]);
+ else
+ text = "";
emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
DBUS_TYPE_STRING_AS_STRING, text, append_basic);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]