commit f2bfc78cd36c7206ed1bcbc87ec0e57016b421c9
parent ee3174fc570293dc21a2bd7724010fbd4aa4167d
Author: Andrew Milkovich <amilkovich@gmail.com>
Date: Fri, 28 Jun 2013 23:04:07 -0700
ensure strings are terminated
Diffstat:
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dwm.suckless.org/patches/dualstatus.md b/dwm.suckless.org/patches/dualstatus.md
@@ -11,7 +11,7 @@ xsetroot -name "Top text;Bottom text"
Download
--------
- * [dwm-6.1-dualstatus.diff](dwm-6.1-dualstatus.diff) (4655b) (20130626)
+ * [dwm-6.1-dualstatus.diff](dwm-6.1-dualstatus.diff) (4690b) (20130628)
Screenshot
----------
diff --git a/dwm.suckless.org/patches/dwm-6.1-dualstatus.diff b/dwm.suckless.org/patches/dwm-6.1-dualstatus.diff
@@ -19,7 +19,7 @@ index d300687..e286e5d 100644
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
diff --git a/dwm.c b/dwm.c
-index 314adf4..0ab7edc 100644
+index 314adf4..09a14f8 100644
--- a/dwm.c
+++ b/dwm.c
@@ -140,6 +140,13 @@ typedef struct {
@@ -132,7 +132,7 @@ index 314adf4..0ab7edc 100644
}
void
-@@ -1920,8 +1960,19 @@ updatetitle(Client *c) {
+@@ -1920,8 +1960,21 @@ updatetitle(Client *c) {
void
updatestatus(void) {
@@ -146,9 +146,11 @@ index 314adf4..0ab7edc 100644
+ char *e = strchr(text, ';');
+ if(e) {
+ *e = '\0'; e++;
-+ strncpy(eb.text, e, sizeof(eb.text));
++ strncpy(eb.text, e, sizeof(eb.text)-1);
+ }
-+ strncpy(stext, text, sizeof(stext));
++ else
++ eb.text[0] = '\0';
++ strncpy(stext, text, sizeof(stext)-1);
+ }
drawbar(selmon);
}