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 12, 2019
1 parent 1252880 commit 9f24d0dbf332696a8a7785e8bb0276b43c7c1522
Showing with 5 additions and 1 deletion.
  1. +5 −1 core/src/console/auth_pam.cc
@@ -109,13 +109,17 @@ bool ConsolePamAuthenticate(FILE* std_in, BareosSocket* UA_sock)
case PamAuthState::SEND_INPUT:
UA_sock->fsend(userinput);
free(userinput);
userinput = nullptr;
state = PamAuthState::INIT;
break;
default:
break;
}
if (UA_sock->IsStop() || UA_sock->IsError()) {
if (userinput) { free(userinput); }
if (userinput) {
free(userinput);
userinput = nullptr;
}
error = true;
break;
}

0 comments on commit 9f24d0d

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