diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2023-03-07 10:53:16 +0100 |
---|---|---|
committer | Olivier Fourdan <fourdan@gmail.com> | 2023-03-08 17:05:59 +0000 |
commit | 1209a1bb57628df108600b09a77b15104e1bf1e2 (patch) | |
tree | cfba7fd452a43b14f83c1a27372d28c4d59ec89c | |
parent | 4e20d96e8dfc9d19b5730c23ae3cc8da811c346e (diff) | |
download | xserver-1209a1bb57628df108600b09a77b15104e1bf1e2.tar.gz |
xwayland: Fix uninitialised value created by a stack allocation
Commit 3c07a01c4 (xwayland: Use xdg-output name for XRandR) changed the
logic to use a fixed sized buffer allocated on the stack to pass to
RROutputCreate() which would then copy it.
Valgrind complains about this:
== Conditional jump or move depends on uninitialised value(s)
== at 0x49954B: MakeAtom (atom.c:87)
== by 0x5108B3: RRMonitorCrtcName (rrmonitor.c:33)
== by 0x510BBB: RRMonitorSetFromServer (rrmonitor.c:92)
== by 0x511882: RRMonitorMakeList (rrmonitor.c:373)
== by 0x512175: ProcRRGetMonitors (rrmonitor.c:634)
== by 0x508091: ProcRRDispatch (randr.c:748)
== by 0x4A860E: Dispatch (dispatch.c:546)
== by 0x4B692F: dix_main (main.c:271)
== by 0x431C90: main (stubmain.c:34)
== Uninitialised value was created by a stack allocation
== at 0x42122C: xwl_output_create (xwayland-output.c:816)
This is actually harmless, but also simple to avoid by just initializing
the content of the array with zeros, so let's just fix that.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Fixes: commit 3c07a01c4 - xwayland: Use xdg-output name for XRandR
-rw-r--r-- | hw/xwayland/xwayland-output.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index afc416560..661e1828d 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -815,7 +815,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id, Bool with_xrandr, uint32_t version) { struct xwl_output *xwl_output; - char name[MAX_OUTPUT_NAME]; + char name[MAX_OUTPUT_NAME] = { '\0', }; xwl_output = calloc(1, sizeof *xwl_output); if (xwl_output == NULL) { |