summaryrefslogtreecommitdiffstats
path: root/text-utils/more.c
diff options
context:
space:
mode:
authorKarel Zak2013-08-01 16:00:21 +0200
committerKarel Zak2013-08-01 16:00:21 +0200
commitc36407293d63d428af176097527df89d623bc74f (patch)
tree9a33fc9381a6a7dd5f456dab0c7a0ba66d4649c6 /text-utils/more.c
parentmkswap: add note about swap header limit to the man page (diff)
downloadkernel-qcow2-util-linux-c36407293d63d428af176097527df89d623bc74f.tar.gz
kernel-qcow2-util-linux-c36407293d63d428af176097527df89d623bc74f.tar.xz
kernel-qcow2-util-linux-c36407293d63d428af176097527df89d623bc74f.zip
more: check for buffer size when write multibyte char
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils/more.c')
-rw-r--r--text-utils/more.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/text-utils/more.c b/text-utils/more.c
index 33771183c..9af15b3ff 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -912,7 +912,8 @@ int get_line(register FILE *f, int *length)
Fseek(f, file_pos_bak);
break_flag = 1;
} else {
- for (i = 0; i < mbc_pos; i++)
+ for (i = 0; p < &Line[LineLen - 1] &&
+ i < mbc_pos; i++)
*p++ = mbc[i];
if (wc_width > 0)
column += wc_width;