fix size use for stdin segmentation fault on invalid unicode input passed to -s option cherry-pick from: 10e9faf901605af5713bc89a5a36631f2025a956
28 lines
876 B
Diff
28 lines
876 B
Diff
From 9714331843ef3a6d9c10ff1d3bc5fcf53d44d930 Mon Sep 17 00:00:00 2001
|
|
From: Karel Zak <kzak@redhat.com>
|
|
Date: Tue, 31 Aug 2021 12:31:15 +0200
|
|
Subject: [PATCH] column: segmentation fault on invalid unicode input passed to
|
|
-s option
|
|
|
|
The function mbs_to_wcs() returns NULL on invalid UTF.
|
|
|
|
Fixes: https://github.com/karelzak/util-linux/issues/1425
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
---
|
|
text-utils/column.c | 2 ++
|
|
1 file changed, 2 insertions(+)
|
|
|
|
diff --git a/text-utils/column.c b/text-utils/column.c
|
|
index 1bc90e84e3..f9878e4422 100644
|
|
--- a/text-utils/column.c
|
|
+++ b/text-utils/column.c
|
|
@@ -814,6 +814,8 @@ int main(int argc, char **argv)
|
|
case 's':
|
|
free(ctl.input_separator);
|
|
ctl.input_separator = mbs_to_wcs(optarg);
|
|
+ if (!ctl.input_separator)
|
|
+ err(EXIT_FAILURE, _("failed to use input separator"));
|
|
ctl.greedy = 0;
|
|
break;
|
|
case 'T':
|