Commit 21a7873f authored by Ralf Habacker's avatar Ralf Habacker

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=90021Reviewed-by: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
parent 2e96b07e
......@@ -149,6 +149,7 @@ reader_init (DBusTypeReader *reader,
const DBusString *value_str,
int value_pos)
{
_DBUS_ZERO (*reader);
reader->byte_order = byte_order;
reader->finished = FALSE;
reader->type_str = type_str;
......@@ -736,11 +737,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 +762,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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment