[hackers] [dwm] dont NUL terminate _NET_WM_NAME || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Wed, 27 Dec 2017 13:38:31 +0100 (CET)

commit db2236001c1cb042a2f24052849da96578273b1c
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Wed Dec 27 13:36:53 2017 +0100
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Wed Dec 27 13:36:53 2017 +0100

    dont NUL terminate _NET_WM_NAME
    
    Reported by Kernc, thanks!
    
    "This makes a particular program that uses libwnck [1] fail after:
    
        Wnck-WARNING **: Property _NET_WM_NAME contained invalid UTF-8
    
    in this code [2] because the returned string contains a '\0' and the
    documentation for g_utf8_validate() [3] explicitly states that when
    string length is provided, no nul bytes are allowed."
    
    It is not entirely clear it is incorrect, other WM's seem to not
    NUL terminate it either though.

diff --git a/dwm.c b/dwm.c
index ff893df..ec6a27c 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -1579,7 +1579,7 @@ setup(void)
         XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
                 PropModeReplace, (unsigned char *) &wmcheckwin, 1);
         XChangeProperty(dpy, wmcheckwin, netatom[NetWMName], utf8string, 8,
- PropModeReplace, (unsigned char *) "dwm", 4);
+ PropModeReplace, (unsigned char *) "dwm", 3);
         XChangeProperty(dpy, root, netatom[NetWMCheck], XA_WINDOW, 32,
                 PropModeReplace, (unsigned char *) &wmcheckwin, 1);
         /* EWMH support per view */
Received on Wed Dec 27 2017 - 13:38:31 CET

This archive was generated by hypermail 2.3.0 : Wed Dec 27 2017 - 13:48:25 CET