mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 01:51:29 +00:00
For execve valgrind would silently fail when argv was NULL or unadressable. Make sure that this produces a warning under memcheck. The linux kernel accepts argv[0] being NULL, but most other kernels don't since posix says it should be non-NULL and it causes argc to be zero which is unexpected and might cause security issues. This adjusts some testcases so they don't rely on execve succeeding when argv is NULL and expect warnings about argv or argv[0] being NULL or unaddressable. https://bugs.kde.org/show_bug.cgi?id=450437
14 lines
236 B
C
14 lines
236 B
C
#include <unistd.h>
|
|
|
|
int main(void)
|
|
{
|
|
char* null_filename = NULL;
|
|
char* bad[2] = { (char*)1, NULL };
|
|
char* good[2] = { "true", NULL };
|
|
|
|
execve(null_filename, bad, bad);
|
|
execve("/bin/true", good, good);
|
|
|
|
return 0;
|
|
}
|