HomeFreeBSD

sort(1): Simplify and bound random seeding

Description

sort(1): Simplify and bound random seeding

Bound input file processing length to avoid the issue reported in [1]. For
simplicity, only allow regular file and character device inputs. For
character devices, only allow /dev/random (and /dev/urandom symblink).

32 bytes of random is perfectly sufficient to seed MD5; we don't need any
more. Users that want to use large files as seeds are encouraged to truncate
those files down to an appropriate input file via tools like sha256(1).

(This does not change the sort algorithm of sort -R.)

[1]: https://lists.freebsd.org/pipermail/freebsd-hackers/2018-August/053152.html

PR: 230792
Reported by: Ali Abdallah <aliovx AT gmail.com>
Relnotes: yes

Details

Provenance
cemAuthored on
Parents
rS346115: The nvlist_report_missing is also used by the cnvlist.
Branches
Unknown
Tags
Unknown