diff options
| -rw-r--r-- | bk_man.c | 2 | ||||
| -rw-r--r-- | wcwidth.c | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -629,7 +629,7 @@ static int man_rdaddwc(rdstringc *rs, word *text, word *end, charset_state s2 = *state; int len = ustrlen(text->text), hyphen = FALSE; - if (text->breaks && text->text[len - 1] == '-') { + if (text->breaks && len > 0 && text->text[len - 1] == '-') { len--; hyphen = TRUE; } @@ -124,7 +124,7 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n) { int w, width = 0; - for (;*pwcs && n-- > 0; pwcs++) + for (; n-- > 0 && *pwcs; pwcs++) if ((w = mk_wcwidth(*pwcs)) < 0) return -1; else |