From 100f95465b4c3804f32af6051841f39dd24e12b74123febdc82fde72c026ee2b Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 29 Sep 2013 18:37:54 +0000 Subject: [PATCH] Accepting request 201241 from home:mgorse:branches: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). OBS-URL: https://build.opensuse.org/request/show/201241 OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=184 --- ...uffer-size-when-write-multibyte-char.patch | 27 ++++++++++++++++ more-guarantee-space-for-multibyte.patch | 32 +++++++++++++++++++ util-linux.changes | 7 ++++ util-linux.spec | 6 ++++ 4 files changed, 72 insertions(+) create mode 100644 more-check-for-buffer-size-when-write-multibyte-char.patch create mode 100644 more-guarantee-space-for-multibyte.patch diff --git a/more-check-for-buffer-size-when-write-multibyte-char.patch b/more-check-for-buffer-size-when-write-multibyte-char.patch new file mode 100644 index 0000000..af179a4 --- /dev/null +++ b/more-check-for-buffer-size-when-write-multibyte-char.patch @@ -0,0 +1,27 @@ +From c36407293d63d428af176097527df89d623bc74f Mon Sep 17 00:00:00 2001 +From: Karel Zak +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 +--- + 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 + diff --git a/more-guarantee-space-for-multibyte.patch b/more-guarantee-space-for-multibyte.patch new file mode 100644 index 0000000..00832ae --- /dev/null +++ b/more-guarantee-space-for-multibyte.patch @@ -0,0 +1,32 @@ +From 418cb4b3bb7a61aec62ebe91194f7722ea608842 Mon Sep 17 00:00:00 2001 +From: Karel Zak +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 +--- + 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 + diff --git a/util-linux.changes b/util-linux.changes index d724676..6d1ea14 100644 --- a/util-linux.changes +++ b/util-linux.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Sep 27 21:58:03 UTC 2013 - mgorse@suse.com + +- 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). + ------------------------------------------------------------------- Fri Sep 27 16:58:40 UTC 2013 - mgorse@suse.com diff --git a/util-linux.spec b/util-linux.spec index 78c81ea..9936a5a 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -102,6 +102,10 @@ Patch4: make-sure-sbin-resp-usr-sbin-are-in-PATH.diff Patch5: eject-scsi-check-host_status-and-driver_status.patch # PATCH-FIX-UPSTREAM more-fix-buffer-overflow.patch bnc839720 mgorse@suse.com -- More: Fix under-allocation of memory. Patch6: more-fix-buffer-overflow.patch +# PATCH-FIX-UPSTREAM more-check-for-buffer-size-when-write-multibyte-char.patch bnc839720 mgorse@suse.com +Patch7: more-check-for-buffer-size-when-write-multibyte-char.patch +# PATCH-FIX-UPSTREAM more-guarantee-space-for-multibyte.patch bnc839720 mgorse@suse.com +Patch8: more-guarantee-space-for-multibyte.patch # disable encryption Patch12: util-linux-2.23.1-noenc-suse.diff @@ -222,6 +226,8 @@ xzcat %{S:0} | %gpg_verify %{S:12} - %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 +%patch8 -p1 %patch12 -p1 # %patch20 -p1