Skip to content
Permalink
Browse files

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
  • Loading branch information...
franku committed Jul 15, 2019
1 parent 5956283 commit d145c8e9fb73bded62389f30e2ddcae936262ec8
Showing with 2 additions and 0 deletions.
  1. +2 −0 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;

0 comments on commit d145c8e

Please sign in to comment.
You can’t perform that action at this time.