Subject: bin/10385: ls(1) doesn't escape special characters in symlink target
To: None <gnats-bugs@gnats.netbsd.org>
From: Ben Harris <bjh21@cam.ac.uk>
List: netbsd-bugs
Date: 06/17/2000 07:54:13
>Number:         10385
>Category:       bin
>Synopsis:       ls(1) doesn't escape special characters in symlink target
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 17 07:55:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Ben Harris
>Release:        1999-11 ish
>Organization:
	University of Cambridge
>Environment:
NetBSD cromarty 1.4X NetBSD 1.4X (CROMARTY) #9: Wed May  3 23:49:51 BST 2000
     bjh21@cromarty:/usr/src/sys/arch/macppc/compile/CROMARTY macppc

>Description:
When giving a long (-l) listing, ls(1) doesn't replace special characters
in the targets of symlinks with question marks.  This means that by
inserting suitable escape sequences in the contents of symbolic links, one
can do arbitrary awkward things to the display of someone running
"ls -l" on a directory, and probably cause ls to appear not to list
certain files.

>How-To-Repeat:
$ ln -s `printf '\033c'` link
$ ls -l
Or, more fun:
$ mkdir hidden
$ ln -s `printf '\033[2K\033[F\033[2K\033[F'` hidden2
$ ls -l

-- 
Ben Harris
Unix Support, University of Cambridge Computing Service.

>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: