Full Disclosure mailing list archives

Re: Windows XP bug


From: Robert Święcki <robert () swiecki net>
Date: Thu, 8 Jul 2010 13:37:40 +0200

But, there is difference with evaluation/calculation in windows and linux.
Here is how...

It rather depends on where the path evaluation takes place - kernel vs
userland. It might also depend on whether 'cd' checks explicitly for
existence of path elements (bash's cd does)

one@ubuntubox:~$ cd thisdoesntexist/
-bash: cd: thisdoesntexist: No such file or directory
one@ubuntubox:~$ cd thisdoesntexist/../
-bash: cd: thisdoesntexist/../: No such file or directory
one@ubuntubox:~$

$ pwd
/tmp

$ ln -s /usr/share a
$ cd a/..
$ pwd
/tmp

$ cd -P a/..
$ pwd
/usr

syscall trace for the case 1.

chdir("/tmp")     (path is being resolved in userland)

for the case 2.

chdir("a/..")      (path is being resolved in kernel)



PS. While we are at this subject: if you ever dreamt of
non-shell-built-in 'cd' command, I recommend checking out this one -
http://www.swiecki.net/red/progs/extcd.c

-- 
Robert Święcki

_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html
Hosted and sponsored by Secunia - http://secunia.com/

Current thread: