3
0
forked from pool/util-linux
util-linux/more-check-for-buffer-size-when-write-multibyte-char.patch

28 lines
789 B
Diff
Raw Normal View History

From c36407293d63d428af176097527df89d623bc74f Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 1 Aug 2013 16:00:21 +0200
Subject: [PATCH] more: check for buffer size when write multibyte char
Signed-off-by: Karel Zak <kzak@redhat.com>
---
text-utils/more.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/text-utils/more.c b/text-utils/more.c
index 3377118..9af15b3 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;
--
1.8.4