From b6b4d28e0c38320ca6753af40845df991118cd11 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alfonso=20S=C3=A1nchez-Beato?= Date: Thu, 6 Jun 2019 17:36:29 +0200 Subject: [PATCH] pppd: Check tdb pointer before closing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Check that pointer to the tdb is not NULL before calling tdb_close(). It is possible that the file could not be opened/created due to permission issues. This change prevents the crash that happens in that case. Signed-off-by: Alfonso Sánchez-Beato --- pppd/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pppd/main.c b/pppd/main.c index 41be532..1b3f1e5 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -1574,7 +1574,8 @@ safe_fork(int infd, int outfd, int errfd) /* Executing in the child */ sys_close(); #ifdef USE_TDB - tdb_close(pppdb); + if (pppdb != NULL) + tdb_close(pppdb); #endif /* make sure infd, outfd and errfd won't get tromped on below */ -- 2.39.2