fix a regression in the previous commit for tab complete
authorHiltjo Posthuma <hiltjo@codemadness.org>
Fri, 2 Sep 2022 17:09:50 +0000 (19:09 +0200)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Fri, 2 Sep 2022 17:09:50 +0000 (19:09 +0200)
Reported by Santtu Lakkala <inz@inz.fi>, thanks!

dmenu.c

diff --git a/dmenu.c b/dmenu.c
index 6b285df1cc5e66febdabc4f4997db298737ce419..818313aafd0fbdf7c56060b1e78daf023e3a5271 100644 (file)
--- a/dmenu.c
+++ b/dmenu.c
@@ -519,7 +519,7 @@ insert:
                        return;
                cursor = strnlen(sel->text, sizeof text - 1);
                memcpy(text, sel->text, cursor);
-               text[sizeof text - 1] = '\0';
+               text[cursor] = '\0';
                match();
                break;
        }