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/?p=coloredstderr%2Fcoloredstderr.git;a=commitdiff_plain;h=f78c0377c1fc1862aaa4103fc6de6cfbe3fd0725 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;