xorg-x11-server-utils/0001-xrandr-init-the-name-to-0.patch

42 lines
1.4 KiB
Diff
Raw Normal View History

From a2134406ab0aef44e7b710e1e2a2a40965e96692 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu, 13 Sep 2018 09:44:16 +1000
Subject: [PATCH app/xrandr] init the name to 0
There are a few conditions where coverity finds a use of an uninitialized
field of the name_t struct. These are rather messy combinations of conditions,
so let's go with the simple solution here and just init everything to 0.
This may still have side-effects but at least they'll be more obvious than the
previous "use whatever memory is leftover from breakfast".
This patch also adds a missing init_name(), much for the same reason.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
xrandr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/xrandr.c b/xrandr.c
index 7f1e867..ce3cd91 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -637,6 +637,7 @@ print_verbose_mode (const XRRModeInfo *mode, Bool current, Bool preferred)
static void
init_name (name_t *name)
{
+ memset(name, 0, sizeof(*name));
name->kind = name_none;
}
@@ -1822,6 +1823,7 @@ get_outputs (void)
output_t *output;
name_t output_name;
if (!output_info) fatal ("could not get output 0x%lx information\n", res->outputs[o]);
+ init_name(&output_name);
set_name_xid (&output_name, res->outputs[o]);
set_name_index (&output_name, o);
set_name_string (&output_name, output_info->name);
--
2.17.1