From: Anselm R Garbe Date: Wed, 17 Apr 2013 18:59:12 +0000 (+0200) Subject: applied Alex Sedov's Tab buffer termination patch, thanks X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=ec64f273fb7660d3746eb765dc02e40726a54294;p=dmenu.git applied Alex Sedov's Tab buffer termination patch, thanks --- 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;