From fea9e3050c99209a05a340e61e617be46547141f Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Tue, 29 Mar 2016 13:06:58 +0200 Subject: [PATCH] options: Check if a port has been given * src/options.c (ssh_options_getopt): Only call 'ssh_options_set' if a port has been given. Signed-off-by: Justus Winter Reviewed-by: Andreas Schneider --- src/options.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/options.c b/src/options.c index 791d8cb4..e238c7b0 100644 --- a/src/options.c +++ b/src/options.c @@ -1179,7 +1179,9 @@ int ssh_options_getopt(ssh_session session, int *argcptr, char **argv) { } } - ssh_options_set(session, SSH_OPTIONS_PORT_STR, port); + if (port != NULL) { + ssh_options_set(session, SSH_OPTIONS_PORT_STR, port); + } ssh_options_set(session, SSH_OPTIONS_SSH1, &ssh1); ssh_options_set(session, SSH_OPTIONS_SSH2, &ssh2);