1
0
forked from pool/util-linux
util-linux/more-guarantee-space-for-multibyte.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

33 lines
848 B
Diff

From 418cb4b3bb7a61aec62ebe91194f7722ea608842 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 1 Aug 2013 16:41:50 +0200
Subject: [PATCH] more: guarantee space for multibyte
.. to make the code more robust.
Signed-off-by: Karel Zak <kzak@redhat.com>
---
text-utils/more.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/text-utils/more.c b/text-utils/more.c
index 9af15b3..ac35acc 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) {
--
1.8.4