Am 03.03.2015 um 17:58 schrieb Ted Unangst:
As a shortcut, filtering out just esc will prevent most terminal damage? I'm not sure what other characters can do, though... I vageuly recall that the intersection of utf-8 and xterm controls is unknowable.poc diff: Index: util.c =================================================================== RCS file: /cvs/src/bin/ls/util.c,v retrieving revision 1.16 diff -u -p -r1.16 util.c --- util.c 21 Nov 2013 15:54:45 -0000 1.16 +++ util.c 3 Mar 2015 16:56:15 -0000 @@ -51,7 +51,7 @@ putname(char *name) int len; for (len = 0; *name; len++, name++) - putchar((!isprint((unsigned char)*name) && f_nonprint) ? '?' : *name); + putchar((*name == 0x1b && f_nonprint) ? '?' : *name); return len; }
Thank you very much! Colorls still showed me ?? for the majority of characters. This patch works as expected.
If the filtering is done for security reasons I just want to humbly add that in many circumstances pressing the tab-key instead of enter will deliver a unsanitized file listing anyway. (By the shell I would assume.)

