util-linux:sync community patches

(cherry picked from commit 3ab2f84d4f2fa5ff41adfb918a73e967ccbfc240)
This commit is contained in:
zhangyao 2024-01-16 10:05:50 +08:00 committed by openeuler-sync-bot
parent 040d8e2382
commit ebccad16af
6 changed files with 187 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 1be53cb47e5e94f5efecaf6ebc55311493343183 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
Date: Tue, 26 Dec 2023 11:18:00 +0100
Subject: [PATCH] cal: avoid out of bound write
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
---
misc-utils/cal.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index 693449dbc..e6f4a6e4f 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -692,9 +692,9 @@ static void headers_init(struct cal_control *ctl)
for (i = 0; i < DAYS_IN_WEEK; i++) {
size_t space_left;
- if (i)
- strcat(cur_dh++, " ");
space_left = sizeof(day_headings) - (cur_dh - day_headings);
+ if (i && space_left)
+ strncat(cur_dh++, " ", space_left--);
if (space_left <= (ctl->day_width - 1))
break;
--
2.33.0

View File

@ -0,0 +1,31 @@
From 5672ba4fb56cce00615b235210d3801a0353c42f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
Date: Sun, 24 Dec 2023 13:32:56 +0100
Subject: [PATCH] libfdisk: (sun) properly initialize partition data
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
---
libfdisk/src/sun.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libfdisk/src/sun.c b/libfdisk/src/sun.c
index dde9750a0..66fd22380 100644
--- a/libfdisk/src/sun.c
+++ b/libfdisk/src/sun.c
@@ -383,6 +383,10 @@ static void fetch_sun(struct fdisk_context *cxt,
lens[i] = 0;
}
}
+ for (i = cxt->label->nparts_max; i < SUN_MAXPARTITIONS; i++) {
+ starts[i] = 0;
+ lens[i] = 0;
+ }
}
/* non-Linux qsort_r(3) has usually differently ordered arguments */
--
2.33.0

View File

@ -0,0 +1,32 @@
From b2b0bf88d35513a746c144f35826eb47692386dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
Date: Tue, 12 Dec 2023 18:41:33 +0100
Subject: [PATCH] libsmartcols: drop spourious newline in between streamed JSON
objects
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
scols_table_print_range() already appends a newline correctly.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
---
misc-utils/findmnt.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index 40b80b365..14ae2c5b4 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -1295,8 +1295,6 @@ static int poll_table(struct libmnt_table *tb, const char *tabfile,
if (count) {
rc = scols_table_print_range(table, NULL, NULL);
- if (rc == 0)
- fputc('\n', scols_table_get_stream(table));
fflush(stdout);
if (rc)
goto done;
--
2.33.0

View File

@ -0,0 +1,29 @@
From 36a853a9a71c46f088ab8f7416d68af112a59ce4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
Date: Tue, 12 Dec 2023 18:42:11 +0100
Subject: [PATCH] libsmartcols: flush correct stream
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
---
misc-utils/findmnt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index 14ae2c5b4..ecd56990c 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -1295,7 +1295,7 @@ static int poll_table(struct libmnt_table *tb, const char *tabfile,
if (count) {
rc = scols_table_print_range(table, NULL, NULL);
- fflush(stdout);
+ fflush(scols_table_get_stream(table));
if (rc)
goto done;
}
--
2.33.0

View File

@ -0,0 +1,46 @@
From 5130ce8ee5b71c249e0c8bb7a4975dc8a48c64fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
Date: Tue, 12 Dec 2023 18:42:44 +0100
Subject: [PATCH] libsmartcols: only recognize closed object as final element
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When streaming JSON normal values also have indent == 1.
For those however it is incorrect to close the stream.
Fixes #2644
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
---
lib/jsonwrt.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/lib/jsonwrt.c b/lib/jsonwrt.c
index dc20d2e46..243ed8232 100644
--- a/lib/jsonwrt.c
+++ b/lib/jsonwrt.c
@@ -154,12 +154,6 @@ void ul_jsonwrt_open(struct ul_jsonwrt *fmt, const char *name, int type)
void ul_jsonwrt_close(struct ul_jsonwrt *fmt, int type)
{
- if (fmt->indent == 1) {
- fputs("\n}\n", fmt->out);
- fmt->indent--;
- fmt->after_close = 1;
- return;
- }
assert(fmt->indent > 0);
switch (type) {
@@ -168,6 +162,8 @@ void ul_jsonwrt_close(struct ul_jsonwrt *fmt, int type)
fputc('\n', fmt->out);
ul_jsonwrt_indent(fmt);
fputs("}", fmt->out);
+ if (fmt->indent == 0)
+ fputs("\n", fmt->out);
break;
case UL_JSON_ARRAY:
fmt->indent--;
--
2.33.0

View File

@ -3,7 +3,7 @@
Name: util-linux Name: util-linux
Version: 2.37.2 Version: 2.37.2
Release: 23 Release: 24
Summary: A random collection of Linux utilities Summary: A random collection of Linux utilities
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
@ -126,6 +126,11 @@ Patch6104: backport-libblkid-reset-errno-before-calling-probefuncs.patch
Patch6105: backport-lib-path-fix-possible-out-of-boundary-access.patch Patch6105: backport-lib-path-fix-possible-out-of-boundary-access.patch
Patch6106: backport-libmount-improve-mnt_table_next_child_fs.patch Patch6106: backport-libmount-improve-mnt_table_next_child_fs.patch
Patch6107: backport-libmount-fix-possible-NULL-dereference-coverity-scan.patch Patch6107: backport-libmount-fix-possible-NULL-dereference-coverity-scan.patch
Patch6108: backport-libsmartcols-drop-spourious-newline-in-between-strea.patch
Patch6109: backport-libsmartcols-flush-correct-stream.patch
Patch6110: backport-libsmartcols-only-recognize-closed-object-as-final-e.patch
Patch6111: backport-cal-avoid-out-of-bound-write.patch
Patch6112: backport-libfdisk-sun-properly-initialize-partition-data.patch
Patch9000: Add-check-to-resolve-uname26-version-test-failed.patch Patch9000: Add-check-to-resolve-uname26-version-test-failed.patch
Patch9001: SKIPPED-no-root-permissions-test.patch Patch9001: SKIPPED-no-root-permissions-test.patch
@ -497,6 +502,17 @@ fi
%{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*} %{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*}
%changelog %changelog
* Tue Jan 16 2024 zhangyao <zhangyao108@huawei.com> - 2.37.2-24
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:sync community patches
[add]backport-libsmartcols-drop-spourious-newline-in-between-strea.patch
backport-libsmartcols-flush-correct-stream.patch
backport-libsmartcols-only-recognize-closed-object-as-final-e.patch
backport-cal-avoid-out-of-bound-write.patch
backport-libfdisk-sun-properly-initialize-partition-data.patch
* Thu Dec 14 2023 zhangyao <zhangyao108@huawei.com> - 2.37.2-23 * Thu Dec 14 2023 zhangyao <zhangyao108@huawei.com> - 2.37.2-23
- Type:bugfix - Type:bugfix
- CVE:NA - CVE:NA