From d145c8e9fb73bded62389f30e2ddcae936262ec8 Mon Sep 17 00:00:00 2001 From: Frank Ueberschar Date: Mon, 15 Jul 2019 15:29:53 +0200 Subject: [PATCH] console: reset a pointer variable after free fixes #1100: bconsole crashes when a pam authentication aborts This fixes a double free of a pointer when the called pam module aborts the authentication i.e. in case of an error --- core/src/console/auth_pam.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/console/auth_pam.cc b/core/src/console/auth_pam.cc index a292d7e37fb..52f80c9a067 100644 --- a/core/src/console/auth_pam.cc +++ b/core/src/console/auth_pam.cc @@ -111,6 +111,7 @@ bool ConsolePamAuthenticate(FILE *std_in, BareosSocket *UA_sock) case PamAuthState::SEND_INPUT: UA_sock->fsend(userinput); Actuallyfree(userinput); + userinput = nullptr; state = PamAuthState::INIT; break; default: @@ -119,6 +120,7 @@ bool ConsolePamAuthenticate(FILE *std_in, BareosSocket *UA_sock) if (UA_sock->IsStop() || UA_sock->IsError()) { if(userinput) { Actuallyfree(userinput); + userinput = nullptr; } error = true; break;