summaryrefslogtreecommitdiffstats
path: root/curs_lib.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2016-04-08 15:20:53 -0700
committerKevin McCarthy <kevin@8t8.us>2016-04-08 15:20:53 -0700
commita9596d5ca71e2469459879b39f4f72fb790ee69f (patch)
treeb3f12d55f17c5013bb73bfe5eee050cb77dd9505 /curs_lib.c
parenta74f8e628157439856f282222e60fc1bb9e3f4b1 (diff)
Reset mbstate for other mbrtowc() calls returning -1
Continue the cleanup started in changesets c8c76a6a1e61 and a3450fd50d11. In those changesets, a bug was occurring due to the mbstate not being reset when mbrtowc() returned -1. This patch fixes other callers of mbrtowc() to reset mbstate when it returns -1.
Diffstat (limited to 'curs_lib.c')
-rw-r--r--curs_lib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/curs_lib.c b/curs_lib.c
index 3178f221..ee1464ca 100644
--- a/curs_lib.c
+++ b/curs_lib.c
@@ -1034,6 +1034,8 @@ int mutt_strwidth (const char *s)
{
if (k == (size_t)(-1) || k == (size_t)(-2))
{
+ if (k == (size_t)(-1))
+ memset (&mbstate, 0, sizeof (mbstate));
k = (k == (size_t)(-1)) ? 1 : n;
wc = replacement_char ();
}