sort segfaults when using the -m flag and no files.
It should default to stdin instead.

Easily reproducible with a simple:
sort -m

Index: sort.c
===================================================================
RCS file: /cvs/src/usr.bin/sort/sort.c,v
retrieving revision 1.86
diff -u -r1.86 sort.c
--- sort.c      14 Jul 2016 08:31:18 -0000      1.86
+++ sort.c      4 Jan 2017 11:19:49 -0000
@@ -1224,7 +1224,10 @@
                struct file_list fl;

                file_list_init(&fl, false);
-               file_list_populate(&fl, argc, argv, true);
+               if (argc < 1)
+                       file_list_add(&fl, "-", true);
+               else
+                       file_list_populate(&fl, argc, argv, true);
                merge_files(&fl, outfile);
                file_list_clean(&fl);
        }

Reply via email to