Cut utility incorrectly replaces null-byte (0x00) with \n (0x0a). Tested with Busybox 1.36.0 and Busybox 1.20.0 ("Busybox in VM" link on the website). Busybox: $ echo -ne "\x00\x01\x02\x03\x04\x05\x06" | ./busybox cut -b 1-3 | hexdump -C 00000000 0a 01 02 03 0a |.....| 00000005 GNU coreutils: $ echo -ne "\x00\x01\x02\x03\x04\x05\x06" | cut -b 1-3 | hexdump -C 00000000 00 01 02 0a |....| 00000004
For what it's worth, POSIX says that cut is only required to operate on text files; a file with an embedded NUL byte is not a text file, so all bets are off on what behavior to expect: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/cut.html, INPUT FILES That said, gratuitous differences from other implementations are still worth patching.