From 5c705dda3f8fd8d250520352ceb4d02338290b1b Mon Sep 17 00:00:00 2001 From: Mark Edgar Date: Sun, 6 Oct 2013 12:19:12 +0200 Subject: [PATCH 4/4] Avoid buffer overrun in bpress(). Use correct type for Mousekey.b (XButtonEvent.button). --- st.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/st.c b/st.c index 9df6707..6ef52e8 100644 --- a/st.c +++ b/st.c @@ -256,9 +256,9 @@ typedef struct { } XWindow; typedef struct { - int b; + uint b; uint mask; - char s[ESC_BUF_SIZ]; + char *s; } Mousekey; typedef struct { @@ -893,7 +893,8 @@ bpress(XEvent *e) { for(mk = mshortcuts; mk < mshortcuts + LEN(mshortcuts); mk++) { if(e->xbutton.button == mk->b - && match(mk->mask, e->xbutton.state)) { + && match(mk->mask, e->xbutton.state) + && mk->s) { ttysend(mk->s, strlen(mk->s)); return; } -- 1.8.4