Skip to content

Commit

Permalink
session client BUGFIX use-after-free
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvasko committed Feb 7, 2024
1 parent 2c9e4e2 commit 5d712ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/session_client_ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1523,16 +1523,18 @@ _nc_connect_libssh(ssh_session ssh_session, struct ly_ctx *ctx, struct nc_keepal
free(host);
goto fail;
}
free(host);

/* create and connect socket */
sock = nc_sock_connect(host, port, -1, ka, NULL, &ip_host);
if (sock == -1) {
ERR(NULL, "Unable to connect to %s:%u (%s).", host, port, strerror(errno));
free(host);
goto fail;
}
ssh_options_set(session->ti.libssh.session, SSH_OPTIONS_FD, &sock);
ssh_set_blocking(session->ti.libssh.session, 0);

free(host);
host = ip_host;
}

Expand Down

0 comments on commit 5d712ac

Please sign in to comment.