Add a few missing sudo_new_key_val() return value checks.

Also use non-exiting allocators for consistency.
This commit is contained in:
Todd C. Miller
2015-05-27 09:42:51 -06:00
parent 8c3fd195d2
commit 4131449ffb
3 changed files with 125 additions and 72 deletions

View File

@@ -54,7 +54,7 @@ static char * const *
disable_execute(char *const envp[])
{
#ifdef _PATH_SUDO_NOEXEC
char *preload, **nenvp = NULL;
char *preload = NULL, **nenvp = NULL;
int env_len, env_size;
int preload_idx = -1;
# ifdef RTLD_PRELOAD_ENABLE_VAR
@@ -107,7 +107,7 @@ disable_execute(char *const envp[])
/* Prepend our LD_PRELOAD to existing value or add new entry at the end. */
if (preload_idx == -1) {
# ifdef RTLD_PRELOAD_DEFAULT
sudo_easprintf(&preload, "%s=%s%s%s", RTLD_PRELOAD_VAR, sudo_conf_noexec_path(), RTLD_PRELOAD_DELIM, RTLD_PRELOAD_DEFAULT);
asprintf(&preload, "%s=%s%s%s", RTLD_PRELOAD_VAR, sudo_conf_noexec_path(), RTLD_PRELOAD_DELIM, RTLD_PRELOAD_DEFAULT);
# else
preload = sudo_new_key_val(RTLD_PRELOAD_VAR, sudo_conf_noexec_path());
# endif