Fix XGetWindowProperty() usage on LP64 archs.

Based on a submission by Alessandro De Laurenzis.
This commit is contained in:
naddy 2020-05-15 16:51:26 +00:00
parent 3dbd7aef75
commit d18f2ad728
2 changed files with 21 additions and 2 deletions

View File

@ -1,8 +1,8 @@
# $OpenBSD: Makefile,v 1.21 2019/07/12 20:51:24 sthen Exp $
# $OpenBSD: Makefile,v 1.22 2020/05/15 16:51:26 naddy Exp $
COMMENT= interact with an EWMH/NetWM window manager
DISTNAME= wmctrl-1.07
REVISION= 8
REVISION= 9
CATEGORIES= x11
MASTER_SITES= ${HOMEPAGE}

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-main_c,v 1.1 2020/05/15 16:51:26 naddy Exp $
Index: main.c
--- main.c.orig
+++ main.c
@@ -1439,8 +1439,12 @@ static gchar *get_property (Display *disp, Window win,
return NULL;
}
+ /* Data returned in 32-bit format is stored as long */
+ if (ret_format == 32)
+ tmp_size = sizeof(long) * ret_nitems;
+ else
+ tmp_size = (ret_format / 8) * ret_nitems;
/* null terminate the result to make string handling easier */
- tmp_size = (ret_format / 8) * ret_nitems;
ret = g_malloc(tmp_size + 1);
memcpy(ret, ret_prop, tmp_size);
ret[tmp_size] = '\0';