Subject: Re: lib/3211: open allows a null path as an arg.
To: Jason Thorpe <firstname.lastname@example.org>
From: Klaus Klein <email@example.com>
Date: 02/12/1997 09:29:57
On Tue, 11 Feb 1997 14:01:19 PST,
Jason Thorpe <firstname.lastname@example.org> wrote:
> > That's a bug I encountered when I started my POSIX work on NetBSD.
> > In general, POSIX.1 section 2.4 (pathname resolution) states:
> > "A null pathname is invalid.", so I simply added a short check:
> ...I agree we should make this change... However, I'd like to also
> know how many programs this breaks :-/
That was my worry, too, but I've been running this change for ~10
days now and have yet to encounter problems in the NetBSD userland
related to this. Of course I'll try to make some clean-sweep to be sure.
> > + if (!error && ndp->ni_pathlen == 1)
> > + error = ENOENT ;
> > +
> Hm, would a more obvious test be:
> if (!error && cnp->cn_pnbuf == '\0')
> error = ENOENT;
Yes, that was my first attempt... I changed over to check pathlen
just for the (possible ?) sake of performance, without readability
in mind. Well, "either way does it", and we should to "something".