From: Jonas Fonseca Date: Mon, 19 Jan 2009 14:19:54 +0000 (+0100) Subject: Fix regression in handling of data for non-UTF-8 locales X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=495fd0788ecb4aeda6ee3b47fbfc000f70368948;p=tig.git Fix regression in handling of data for non-UTF-8 locales The bug was introduced in 65498141015b6070cf5c9b5704039389dba76e90 where the the IO API was changed from using stdio to 'raw' file descriptors. Part of the change removed the need for cutting the ending newline from the input line in update_view(). This caused the resulting iconv output buffer to not be NUL terminated since the input string no longer contained an ending NULL byte. Reported by Pavel Roskin. --- diff --git a/NEWS b/NEWS index 2ac62ca..2dda520 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,7 @@ Improvements: Bug fixes: - Tree view: fix memory corruption bug when updating. + - Fix regression for non-UTF-8 locales corrupting the view data. tig-0.13 -------- diff --git a/tig.c b/tig.c index 101d0b7..b16fe24 100644 --- a/tig.c +++ b/tig.c @@ -2707,7 +2707,7 @@ update_view(struct view *view) if (opt_iconv != ICONV_NONE) { ICONV_CONST char *inbuf = line; - size_t inlen = linelen; + size_t inlen = linelen + 1; char *outbuf = out_buffer; size_t outlen = sizeof(out_buffer);