dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit f9978363867025d4ab996f522d2ac65b851a8fe9
parent ecba86bf0ac06723aebe8e818876f1ed33649190
Author: Greg Reagle <greg.reagle@umbc.edu>
Date:   Mon, 16 Dec 2013 15:00:00 +0100

statusbar: src and dest of strncpy must not overlap

Diffstat:
dvtm.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/dvtm.c b/dvtm.c @@ -1228,11 +1228,12 @@ handle_statusbar() { bar.fd = -1; break; default: - bar.text[r] = '\0'; p = bar.text + strlen(bar.text) - 1; + bar.text[r] = '\0'; + p = bar.text + r - 1; for (; p >= bar.text && *p == '\n'; *p-- = '\0'); for (; p >= bar.text && *p != '\n'; --p); - if (p > bar.text) - strncpy(bar.text, p + 1, sizeof bar.text); + if (p >= bar.text) + memmove(bar.text, p + 1, strlen(p)); drawbar(); } }