Skip to content

Commit

Permalink
console: reset a pointer variable after free
Browse files Browse the repository at this point in the history
    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 d145c8e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/console/auth_pam.cc
Expand Up @@ -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:
Expand All @@ -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;
Expand Down

0 comments on commit d145c8e

Please sign in to comment.