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