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>
This commit is contained in:
Karel Zak 2021-08-31 12:31:15 +02:00
parent 4693a1bba9
commit 9714331843
1 changed files with 2 additions and 0 deletions

View File

@ -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':