1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix execl(3) sentinel undefined behaviour.

execl(3) and its variants use a sentinel to terminate the variadic
argument list, in the form of a null pointer constant of type pointer to
char. POSIX mandates that NULL is a null pointer constant of type
pointer to void, which is not of an equivalent type to that required by
execl(3) and its variants, resulting in undefined behaviour.

This commit casts all such instances of NULL to pointer to char type.
For consistency, it also adds const-qualification to any such instances
which had already been casted, and were not const-qualified.
This commit is contained in:
Ralph Holmes 2016-09-30 16:40:17 +01:00 committed by Jonas 'Sortie' Termansen
parent 6907109b7e
commit 5d774cce1d
8 changed files with 14 additions and 14 deletions

View file

@ -91,13 +91,13 @@ bool dispd_session_setup_game_rgba(struct dispd_session* session)
const char* chvideomode = "chvideomode";
#if 1
// TODO chvideomode currently launches --bpp 32 as a program...
execlp(chvideomode, chvideomode, NULL);
execlp(chvideomode, chvideomode, (const char*) NULL);
#else
execlp(chvideomode, chvideomode,
"--bpp", "32",
"--show-graphics", "true",
"--show-text", "false",
NULL);
(const char*) NULL);
#endif
perror(chvideomode);
exit(127);