dmenu

dynamic menu
git clone git://git.suckless.org/dmenu
Log | Files | Refs | README | LICENSE

commit 61e0072c3e6adfc67bafbc84e376cf26bc3680c0
parent 0785a28f1d6e27e18ab998d20b0390e2c3ec226c
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun, 13 Sep 2026 20:48:49 +0200

keypress, check if len > 0 just in case before reading buf

I'm not sure if this can happen, but check it just in case:

Maybe possible when:

len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
len == 0 and case XLookupChars would be executed on a keypress.

Reported by: jb19357 <jb19357@protonmail.com>
Who used Claude to write a report.

I cannot reproduce this issue, but it seems logical.

Diffstat:
Mdmenu.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dmenu.c b/dmenu.c @@ -414,7 +414,7 @@ keypress(XKeyEvent *ev) switch(ksym) { default: insert: - if (!iscntrl((unsigned char)*buf)) + if (len > 0 && !iscntrl((unsigned char)*buf)) insert(buf, len); break; case XK_Delete: