From: Karel Zak Date: Thu, 1 Aug 2013 14:41:50 +0000 (+0200) Subject: more: guarantee space for multibyte X-Git-Tag: v2.24-rc1~407 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=418cb4b3bb7a61aec62ebe91194f7722ea608842;p=thirdparty%2Futil-linux.git more: guarantee space for multibyte .. to make the code more robust. Signed-off-by: Karel Zak --- diff --git a/text-utils/more.c b/text-utils/more.c index 9af15b3ff4..ac35acc0bd 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -1030,6 +1030,12 @@ int get_line(register FILE *f, int *length) if (column >= Mcol && fold_opt) break; +#ifdef HAVE_WIDECHAR + if (use_mbc_buffer_flag == 0 && p >= &Line[LineLen - 1 - 4]) + /* don't read another char if there is no space for + * whole multibyte sequence */ + break; +#endif c = Getc(f); } if (column >= Mcol && Mcol > 0) {