From: Simon Ruderich Date: Thu, 1 Feb 2018 20:40:02 +0000 (+0100) Subject: Prevent crash in execve() if env is NULL X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;p=coloredstderr%2Fcoloredstderr.git Prevent crash in execve() if env is NULL --- diff --git a/src/coloredstderr.c b/src/coloredstderr.c index d270071..9161fc3 100644 --- a/src/coloredstderr.c +++ b/src/coloredstderr.c @@ -554,6 +554,11 @@ pid_t vfork(void) { HOOK_FUNC_DEF3(int, execve, char const *, filename, char * const *, argv, char * const *, env) { DLSYM_FUNCTION(real_execve, "execve"); + char * const fake_env[] = {NULL}; + if (env == NULL) { + env = fake_env; + } + /* Count environment variables. */ size_t count = 0; char * const *x = env;