aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_util.c
diff options
context:
space:
mode:
authorSeebs <seebs@seebs.net>2017-04-13 18:12:01 -0500
committerSeebs <seebs@seebs.net>2017-04-13 18:12:01 -0500
commitb6b68db896f9963558334aff7fca61adde4ec10f (patch)
tree8eb28f2114259cc06af53961b8b60c09d45ac30d /pseudo_util.c
parentefe0be279901006f939cd357ccee47b651c786da (diff)
downloadpseudo-b6b68db896f9963558334aff7fca61adde4ec10f.tar.gz
pseudo-b6b68db896f9963558334aff7fca61adde4ec10f.tar.bz2
pseudo-b6b68db896f9963558334aff7fca61adde4ec10f.zip
Prevent bash from segfaulting when unloading pseudo
bash's extremely fancy internal awareness of how the environment looks means that, if you directly call the underlying libc "unsetenv" on a variable, bash can end up trying to access a null pointer. Fixing this generically is actually rather hard; you can't really avoid writing to environ on fork() or popen(), even if you change all execv*() functions to use the execv*e() variants. So for now, instead of unsetting the variable, set it to an empty string. Thanks to Saur in IRC for spotting this and helping debug it. Signed-off-by: Seebs <seebs@seebs.net>
Diffstat (limited to 'pseudo_util.c')
-rw-r--r--pseudo_util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pseudo_util.c b/pseudo_util.c
index 172990b..6a1fac2 100644
--- a/pseudo_util.c
+++ b/pseudo_util.c
@@ -844,7 +844,7 @@ void pseudo_dropenv() {
if (ld_preload && strlen(ld_preload)) {
SETENV(PRELINK_LIBRARIES, ld_preload, 1);
} else {
- UNSETENV(PRELINK_LIBRARIES);
+ SETENV(PRELINK_LIBRARIES, "", 1);
}
}
}