Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jan 2002 00:54:20 +0100
From:      Marc Olzheim <marcolz@stack.nl>
To:        gnats-admin@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:        Marc Olzheim <marcolz@stack.nl>, Serge van den Boom <svdb@stack.nl>
Subject:   Re: kern/33738: [PATCH] empty argv
Message-ID:  <20020110005420.A97745@stack.nl>
In-Reply-To: <200201091930.g09JU1T85304@freefall.freebsd.org>; from gnats-admin@FreeBSD.org on Wed, Jan 09, 2002 at 11:30:01AM -0800
References:  <20020109202852.A61938@stack.nl> <200201091930.g09JU1T85304@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
	
--FL5UXtIhxfXey3p5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

> 	OpenBSD does not allow empty argv, returning -1 and EFAULT in
> 	errno (the man page says it should return EINVAL, but it
> 	doesn't).

Hmm, OpenBSD does the same as FreeBSD when argv is (char **) { NULL }.
(Just replace 'NULL' with '(char **) { NULL }' in noargv.c, which I
forgot tho attach.
Perhaps this should be caught as well in execve(2). One could also argue
that setuid programmers should expect the unexpected, but why not make
it easier on them...

Marc

--FL5UXtIhxfXey3p5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="noargv.c"

#include	<stdio.h>
#include	<unistd.h>

int
main(int argc, char *argv[])
{
	if (argc != 2)
	{
		fprintf(stderr, "Usage: %s <prog>\n", argv[0]);
		return(1);
	}

	execv(argv[1], NULL);

	return(0);
}

--FL5UXtIhxfXey3p5--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020110005420.A97745>