]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
column: segmentation fault on invalid unicode input passed to -s option
authorKarel Zak <kzak@redhat.com>
Tue, 31 Aug 2021 10:31:15 +0000 (12:31 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 31 Aug 2021 10:31:15 +0000 (12:31 +0200)
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

index 1bc90e84e3f766e1a718a785d439055ab05014fd..f9878e4422e8f2b50babd2c0441d2793fb6e4cfd 100644 (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':