From 37476164f15a45015310b9d4b197c2d7db1f7f8f Mon Sep 17 00:00:00 2001 From: "Martin.Lottermoser@t-online.de" Date: Sun, 9 Jun 2013 22:04:25 +1000 Subject: [PATCH] pppd: Fix segfault in update_db_entry() The function update_db_entry() may only be called if pppdb is not NULL; unfortunately in one situation it is. Other calls to update_db_entry() are protected against this, see, e.g., the end of script_setenv(). This is from the Debian pppd patches, and fixes Debian bug 308136 (SEGV in pppd). Signed-off-by: Paul Mackerras --- pppd/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pppd/main.c b/pppd/main.c index 6e7378b..6d50d1b 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -2043,9 +2043,11 @@ script_setenv(var, value, iskey) free(p-1); script_env[i] = newstring; #ifdef USE_TDB - if (iskey && pppdb != NULL) - add_db_key(newstring); - update_db_entry(); + if (pppdb != NULL) { + if (iskey) + add_db_key(newstring); + update_db_entry(); + } #endif return; } -- 2.39.2