diff options
| author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2026-10-13 14:34:59 +0200 |
|---|---|---|
| committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2026-10-16 13:26:00 +0200 |
| commit | ce41d3479103fe818466cde9394cce9ac314f519 (patch) | |
| tree | f3151a8d48520ae75f1eb8f1d2079772bb87d81d | |
| parent | ignore malformed ConfigureNotify with width or height <= 0 (diff) | |
| download | dwm-ce41d3479103fe818466cde9394cce9ac314f519.tar.gz dwm-ce41d3479103fe818466cde9394cce9ac314f519.zip | |
properly NUL terminate ltsymbol
Although this is config error in config.h if the symbol is too long.
Make sure it is correct.
Note that the symbol would then get truncated.
| -rw-r--r-- | dwm.c | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -395,7 +395,8 @@ arrange(Monitor *m) | |||
| 395 | void | 395 | void |
| 396 | arrangemon(Monitor *m) | 396 | arrangemon(Monitor *m) |
| 397 | { | 397 | { |
| 398 | strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol); | 398 | strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof(m->ltsymbol) - 1); |
| 399 | m->ltsymbol[sizeof(m->ltsymbol) - 1] = '\0'; | ||
| 399 | if (m->lt[m->sellt]->arrange) | 400 | if (m->lt[m->sellt]->arrange) |
| 400 | m->lt[m->sellt]->arrange(m); | 401 | m->lt[m->sellt]->arrange(m); |
| 401 | } | 402 | } |
| @@ -645,7 +646,8 @@ createmon(void) | |||
| 645 | m->topbar = topbar; | 646 | m->topbar = topbar; |
| 646 | m->lt[0] = &layouts[0]; | 647 | m->lt[0] = &layouts[0]; |
| 647 | m->lt[1] = &layouts[1 % LENGTH(layouts)]; | 648 | m->lt[1] = &layouts[1 % LENGTH(layouts)]; |
| 648 | strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); | 649 | strncpy(m->ltsymbol, layouts[0].symbol, sizeof(m->ltsymbol) - 1); |
| 650 | m->ltsymbol[sizeof(m->ltsymbol) - 1] = '\0'; | ||
| 649 | return m; | 651 | return m; |
| 650 | } | 652 | } |
| 651 | 653 | ||
