From 4666d2f0d5c033e73df2b8b81597b8080648e972 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Wed, 6 May 2015 09:21:43 +0200 Subject: [PATCH 5/5] reader_init: Initialize all fields of struct DBusTypeReader (CID 54754, 54772, 54773). This patch is based on the fix for 'Field reader.array_len_offset is uninitialized' Reported by Coverity: CID 54754, 54772, 54773: Uninitialized scalar variable (UNINIT) Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021 --- dbus/dbus-marshal-recursive.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dbus/dbus-marshal-recursive.c b/dbus/dbus-marshal-recursive.c index 4adfd2e..19864da 100644 --- a/dbus/dbus-marshal-recursive.c +++ b/dbus/dbus-marshal-recursive.c @@ -155,6 +155,9 @@ reader_init (DBusTypeReader *reader, reader->type_pos = type_pos; reader->value_str = value_str; reader->value_pos = value_pos; + reader->array_len_offset = 0; + reader->u.array.start_pos = 0; + reader->klass = NULL; } static void @@ -736,11 +739,11 @@ _dbus_type_reader_init (DBusTypeReader *reader, const DBusString *value_str, int value_pos) { - reader->klass = &body_reader_class; - reader_init (reader, byte_order, type_str, type_pos, value_str, value_pos); + reader->klass = &body_reader_class; + #if RECURSIVE_MARSHAL_READ_TRACE _dbus_verbose (" type reader %p init type_pos = %d value_pos = %d remaining sig '%s'\n", reader, reader->type_pos, reader->value_pos, @@ -761,11 +764,11 @@ _dbus_type_reader_init_types_only (DBusTypeReader *reader, const DBusString *type_str, int type_pos) { - reader->klass = &body_types_only_reader_class; - reader_init (reader, DBUS_COMPILER_BYTE_ORDER /* irrelevant */, type_str, type_pos, NULL, _DBUS_INT_MAX /* crashes if we screw up */); + reader->klass = &body_types_only_reader_class; + #if RECURSIVE_MARSHAL_READ_TRACE _dbus_verbose (" type reader %p init types only type_pos = %d remaining sig '%s'\n", reader, reader->type_pos, -- 1.8.4.5