Through applying concolic testing to busybox ls code, we found that busybox ls does not print space between two columns when 1. -i option is given 2. an index number is more than 8 digits 3. a length of the full file name in the 1st column is no less than 2nd column's file name ------------------------------- // Linux ls output $ ls -i ~yang/12345 ~yang/11111 154930324 /home/yang/11111 154930124 /home/yang/12345 // Busybox ls output $ ./busybox ls -i ~yang/12345 ~yang/11111 154930324 /home/yang/11111154930124 /home/yang/12345 // A user cannot distinquish a file name in the first column and // an index number of the second column, since // no space is given between column 1 and column 2. --------------------------------- The bug is in line 756 of ls.c (showfiles()) where ls assumes that an index number for a file is only 8 digits. Similar error can happen for files with large block numbers that are longer than 5 digits (see line 757). 754: column_width += tabstops + 755: IF_SELINUX( ((all_fmt & LIST_CONTEXT) ? 33 : 0) + ) 756: ((all_fmt & LIST_INO) ? 8 : 0) + // maximum length is ONLY 8 757: ((all_fmt & LIST_BLOCKS) ? 5 : 0); // maximum length is ONLY 5
Fixed in git: http://git.busybox.net/busybox/commit/?id=2f7d9e8903029b1b5e51a15f9cb0dcb6ca17c3ac Will be in 1.19.x