Xnest: dont use VLA

Replace VLA usage by calloc()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-02-21 20:00:16 +01:00
parent 5038b4e413
commit e439636c39

View File

@ -170,7 +170,10 @@ void xnest_set_command(
if (nbytes >= (2^16) - 1) if (nbytes >= (2^16) - 1)
return; return;
char buf[nbytes+1]; char *buf = calloc(1, nbytes+1);
if (!buf)
return; // BadAlloc
char *bp = buf; char *bp = buf;
/* copy arguments into single buffer */ /* copy arguments into single buffer */
@ -187,6 +190,7 @@ void xnest_set_command(
8, 8,
nbytes, nbytes,
buf); buf);
free(buf);
} }
void xnest_xkb_init(xcb_connection_t *conn) void xnest_xkb_init(xcb_connection_t *conn)