summaryrefslogtreecommitdiff
path: root/bspwm/0003-Fix-segfault-caused-by-non-null-terminated-string.patch
diff options
context:
space:
mode:
authorJohn Vogel <jvogel@stygian.me>2025-02-01 18:07:06 -0500
committerJohn Vogel <jvogel@stygian.me>2025-02-01 18:07:06 -0500
commit473821331574b6d292e5e9b381025371f8df7af2 (patch)
treea8f77083231d6e052cc951e99fd0653005dc19a0 /bspwm/0003-Fix-segfault-caused-by-non-null-terminated-string.patch
parentc6f27c7035b185bac7256a329a620b8f9ea72227 (diff)
downloadforked-aports-473821331574b6d292e5e9b381025371f8df7af2.tar.gz
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.
Diffstat (limited to 'bspwm/0003-Fix-segfault-caused-by-non-null-terminated-string.patch')
-rw-r--r--bspwm/0003-Fix-segfault-caused-by-non-null-terminated-string.patch29
1 files changed, 29 insertions, 0 deletions
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 <falsifian@falsifian.org>
+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
+