From 473821331574b6d292e5e9b381025371f8df7af2 Mon Sep 17 00:00:00 2001 From: John Vogel Date: Sat, 1 Feb 2025 18:07:06 -0500 Subject: local/bspwm: add some fixes Upstream PR's 1480 and 1504 (issue 1503), add patches. 1480 revamps signal handling and adds needed include. 1504 fixes null ptr deref. --- ...ault-caused-by-non-null-terminated-string.patch | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 bspwm/0003-Fix-segfault-caused-by-non-null-terminated-string.patch (limited to 'bspwm/0003-Fix-segfault-caused-by-non-null-terminated-string.patch') diff --git a/bspwm/0003-Fix-segfault-caused-by-non-null-terminated-string.patch b/bspwm/0003-Fix-segfault-caused-by-non-null-terminated-string.patch new file mode 100644 index 0000000..edec54e --- /dev/null +++ b/bspwm/0003-Fix-segfault-caused-by-non-null-terminated-string.patch @@ -0,0 +1,29 @@ +From c631b202ab85267759fa875db11e0fa6b0324eaf Mon Sep 17 00:00:00 2001 +From: James Cook +Date: Fri, 19 Jul 2024 17:20:13 +0000 +Subject: [PATCH 3/3] Fix segfault caused by non-null-terminated string. + +I got the printf %.*s idea from xcb documentation somewhere but now I +can't find it. + +Fixes #1503 +--- + src/rule.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/rule.c b/src/rule.c +index b7e55aa..2bf41e8 100644 +--- a/src/rule.c ++++ b/src/rule.c +@@ -307,7 +307,7 @@ void _apply_name(xcb_window_t win, rule_consequence_t *csq) + { + xcb_icccm_get_text_property_reply_t reply; + if (xcb_icccm_get_wm_name_reply(dpy, xcb_icccm_get_wm_name(dpy, win), &reply, NULL) == 1) { +- snprintf(csq->name, sizeof(csq->name), "%s", reply.name); ++ snprintf(csq->name, sizeof(csq->name), "%.*s", reply.name_len, reply.name); + xcb_icccm_get_text_property_reply_wipe(&reply); + } + } +-- +2.47.1 + -- cgit v1.2.3