3
0
forked from pool/util-linux
util-linux/more-check-for-buffer-size-when-write-multibyte-char.patch
Stephan Kulow e3cc16fab3 Accepting request 201407 from Base:System
- Add more-check-for-buffer-size-when-write-multibyte-char.patch and
  more-guarantee-space-for-multibyte.patch -- check for buffer space with
  multi-byte chars (BNC#829720). (forwarded request 201241 from mgorse)

OBS-URL: https://build.opensuse.org/request/show/201407
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/util-linux?expand=0&rev=167
2013-09-30 07:32:48 +00:00

28 lines
789 B
Diff

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