summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dmenu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/dmenu.c b/dmenu.c
index efc1e54..c25dc82 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -392,7 +392,8 @@ keypress(XKeyEvent *ev) {
case XK_Tab:
if(!sel)
return;
- strncpy(text, sel->text, sizeof text);
+ strncpy(text, sel->text, sizeof text - 1);
+ text[sizeof text - 1] = '\0';
cursor = strlen(text);
match();
break;