summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@ozlabs.org>2018-06-23 17:26:42 +1000
committerPaul Mackerras <paulus@ozlabs.org>2018-06-23 17:26:42 +1000
commitb5a2fd5ca2cd00b564d829c352d825902fba13a0 (patch)
treef7b5ad3b06dca31074f026993337a2ad687ed404
parent292c35d97edb6eca5f7af7aae31488cca2c2ca6f (diff)
downloadppp-b5a2fd5ca2cd00b564d829c352d825902fba13a0.tar.gz
pppd: Don't try to free(NULL - 1)
A logic bug in update_script_environment() means that it can call remove_script_env() even when the variable being removed is not present in the script_env array. The result of that is that remove_script_env() will call free() with argument NULL - 1. To fix this, we avoid calling remove_script_env() in this case. Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
-rw-r--r--pppd/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pppd/main.c b/pppd/main.c
index 76b67d2..e09b6ff 100644
--- a/pppd/main.c
+++ b/pppd/main.c
@@ -1751,7 +1751,7 @@ update_script_environment()
script_env[i] = newstring;
else
add_script_env(i, newstring);
- } else {
+ } else if (p != NULL) {
remove_script_env(i);
}
}