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 33c7f1f..5728dfb 100644
--- a/text-utils/column.c
+++ b/text-utils/column.c
@@ -769,6 +769,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':
-- 
2.27.0

