From owner-freebsd-hackers Sat Oct 16 11:20:18 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from alive.znep.com (alive.znep.com [207.167.15.58]) by hub.freebsd.org (Postfix) with ESMTP id 1BE7B15162 for ; Sat, 16 Oct 1999 11:20:12 -0700 (PDT) (envelope-from marcs@znep.com) Received: from localhost (marcs@localhost) by alive.znep.com (8.9.3/8.9.1) with ESMTP id MAA14034 for ; Sat, 16 Oct 1999 12:20:11 -0600 (MDT) (envelope-from marcs@znep.com) Date: Sat, 16 Oct 1999 12:20:11 -0600 (MDT) From: Marc Slemko To: hackers@freebsd.org Subject: MAXPATHLEN not enforced Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Content-Transfer-Encoding: QUOTED-PRINTABLE Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Why does FreeBSD let you create paths longer than MAXPATHLEN? =20 I often have various trees that are as deep as possible for testing various programs for holes, and I finally figured out why locate wasn't updating it= s database properly; it was choking as soon as it saw a path length=20 >MAXPATHLEN long. The question, however, is why can it see a path length longer than MAXPATHLEN? I would also wonder if there aren't some security issues resulting from this. From what gdb shows, locate seems to trash its stack before spitting out the error about the path being too long... marcs@alive:/tmp$ mkdir erm... marcs@alive:/tmp$ cd erm... marcs@alive:/tmp/erm...$ while mkdir xxxxx; do cd xxxxx; done cd: could not get current directory: getcwd: cannot access parent directori= es: Result too large cd: could not get current directory: getcwd: cannot access parent directori= es: Result too large ^Cjob-working-directory: could not get current directory: getcwd: cannot ac= cess parent directories: Result too large cd_links: could not get current directory: getcwd: cannot access parent dir= ectories: Result too large ^C^C^C^C^Ccd: could not get current directory: getcwd: cannot access parent= directories: Result too large ^C^C^C^C^Ccd: could not get current directory: getcwd: cannot access parent= directories: Result too large ^C^C^C^C^C^C^C^C^C^C^C^C^C ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C marcs@alive:.$ cd / cd_links: could not get current directory: getcwd: cannot access parent dir= ectories: Result too large marcs@alive:/$ find /tmp/erm.../ | perl -ne 'if (length($_) > 1024) { print= length($_), ": $_\n" }' (...a few other results...) 1038: /tmp/erm.../xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxx= xx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/= xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxx= xx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/= xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxx= xx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/= xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxx= xx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/= xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxx= xx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/= xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxx= xx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/= xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxx= xx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx/xxxxx To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message