NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/56673: don't allow execve with NULL argv

>Number:         56673
>Category:       kern
>Synopsis:       don't allow execve with NULL argv
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 26 15:55:01 +0000 2022
>Originator:     Jan Schaumann

As illustrated on Linux by e.g.,,
calling execve(2) with a NULL argv can have unexpected consequences.

OpenBSD, for example, does not permit exexcve with a NULL argv, but NetBSD

I'd suggest to fail if the argv is NULL.


$ cat <<EOF >a.c
#include <stdlib.h>
#include <unistd.h>

int main() {
	char *argv[]={ NULL };
	char *envp[]={ NULL };
	execve("/bin/sh", argv, envp);
$ cc a.c
$ ./a.out


Home | Main Index | Thread Index | Old Index