]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
execve: disallow argc == 0
authorKyle Evans <kevans@FreeBSD.org>
Tue, 25 Jan 2022 22:47:23 +0000 (16:47 -0600)
committerKyle Evans <kevans@FreeBSD.org>
Wed, 26 Jan 2022 19:40:27 +0000 (13:40 -0600)
commit773fa8cd136a5775241c3e3a70f1997633ebeedf
treea7bdb939c34184b62c9d3571577618beead8d35a
parent5cf00496537a27d0f4bece7f5783327b59c2146b
execve: disallow argc == 0

The manpage has contained the following verbiage on the matter for just
under 31 years:

"At least one argument must be present in the array"

Previous to this version, it had been prefaced with the weakening phrase
"By convention."

Carry through and document it the rest of the way.  Allowing argc == 0
has been a source of security issues in the past, and it's hard to
imagine a valid use-case for allowing it.  Toss back EINVAL if we ended
up not copying in any args for *execve().

The manpage change can be considered "Obtained from: OpenBSD"

Reviewed by: emaste, kib, markj (all previous version)
Differential Revision: https://reviews.freebsd.org/D34045
lib/libc/sys/execve.2
sys/kern/kern_exec.c