loader/dri3: Use strlen instead of sizeof for creating VRR property atom
authorMichel Dänzer <michel.daenzer@amd.com>
Mon, 4 Feb 2019 17:53:52 +0000 (18:53 +0100)
committerMichel Dänzer <michel@daenzer.net>
Tue, 5 Feb 2019 17:18:44 +0000 (17:18 +0000)
sizeof counts the terminating null character as well, so that also
contributed to the ID computed for the X11 atom. But the convention is
for only the non-null characters to contribute to the atom ID.

Fixes: 2e12fe425fe3 "loader/dri3: Enable adaptive_sync via
                     _VARIABLE_REFRESH property"
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/loader/loader_dri3_helper.c

index ad9b9d87b05325d08a29087c1690c3a174600231..7d61c1df4fca41ca646a9eba5d03b528ebdf4dac 100644 (file)
@@ -111,7 +111,7 @@ set_adaptive_sync_property(xcb_connection_t *conn, xcb_drawable_t drawable,
    xcb_intern_atom_reply_t* reply;
    xcb_void_cookie_t check;
 
-   cookie = xcb_intern_atom(conn, 0, sizeof(name), name);
+   cookie = xcb_intern_atom(conn, 0, strlen(name), name);
    reply = xcb_intern_atom_reply(conn, cookie, NULL);
    if (reply == NULL)
       return;