diff --git a/dmenu.c b/dmenu.c index da66121..07b466d 100644 --- a/dmenu.c +++ b/dmenu.c @@ -607,7 +607,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; }