This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository libx2goclient.
commit c393648c3b49057243142a17379bcd6945244ee4 Author: Mihai Moldovan <io...@ionic.de> Date: Fri May 29 11:23:44 2020 +0200 src/x2goclient-network-ssh.{c,h}: add more type checks and fix falldown from that. --- src/x2goclient-network-ssh.c | 24 ++++++++++++++++++------ src/x2goclient-network-ssh.h | 1 + 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c index b52c37e..e26ad58 100644 --- a/src/x2goclient-network-ssh.c +++ b/src/x2goclient-network-ssh.c @@ -69,7 +69,11 @@ static void x2goclient_network_options_ssh_init (X2GoClientNetworkOptionsSSH *se } GPtrArray* x2goclient_network_options_ssh_to_array (X2GoClientNetworkOptionsSSH *self) { - GPtrArray *ret = g_ptr_array_new_with_free_func (&x2goclient_clear_strings); + GPtrArray *ret = NULL; + + g_return_val_if_fail (X2GOCLIENT_IS_NETWORK_OPTIONS_SSH (self), ret); + + g_ptr_array_new_with_free_func (&x2goclient_clear_strings); /* Implement actual options fetching here. */ @@ -611,6 +615,8 @@ static GSocketAddress* x2goclient_network_ssh_parse_sockspec_alias (const GStrin static GSocketAddress* x2goclient_network_ssh_parse_sockspec (X2GoClientNetwork *parent, const GString * const sockspec) { GSocketAddress *ret = NULL; + g_return_val_if_fail (X2GOCLIENT_IS_NETWORK (parent), ret); + if (sockspec) { /* Check if it's possibly a UNIX socket. */ ret = x2goclient_network_ssh_parse_sockspec_unix_socket (sockspec); @@ -869,13 +875,19 @@ static gboolean x2goclient_network_ssh_parent_connect (X2GoClientNetwork *parent /* Get string-array representation. */ GPtrArray *options_arr = x2goclient_network_options_ssh_to_array (options); - /* Add each element to command. */ - for (size_t i = 0; i < options_arr->len; ++i) { - g_ptr_array_add (ssh_cmd, g_strdup ("-o")); - g_ptr_array_add (ssh_cmd, g_strdup ((gchar *)g_ptr_array_index (options_arr, i))); + if (!(options_arr)) { + g_set_error_literal (gerr, X2GOCLIENT_NETWORK_SSH_ERROR, X2GOCLIENT_NETWORK_SSH_ERROR_CONNECT_OPTIONS_INVALID, "Unable to convert options stucture to an array, can't connect."); + ret = FALSE; } + else { + /* Add each element to command. */ + for (size_t i = 0; i < options_arr->len; ++i) { + g_ptr_array_add (ssh_cmd, g_strdup ("-o")); + g_ptr_array_add (ssh_cmd, g_strdup ((gchar *)g_ptr_array_index (options_arr, i))); + } - g_ptr_array_unref (options_arr); + g_ptr_array_unref (options_arr); + } } /* Add control path options. */ diff --git a/src/x2goclient-network-ssh.h b/src/x2goclient-network-ssh.h index 47441b0..b85f49b 100644 --- a/src/x2goclient-network-ssh.h +++ b/src/x2goclient-network-ssh.h @@ -66,6 +66,7 @@ enum { X2GOCLIENT_NETWORK_SSH_ERROR_CONNECT_INET_ADDR_NULL, X2GOCLIENT_NETWORK_SSH_ERROR_CONNECT_NATIVE_FETCH, X2GOCLIENT_NETWORK_SSH_ERROR_CONNECT_SOCK_ADDR_UNKNOWN, + X2GOCLIENT_NETWORK_SSH_ERROR_CONNECT_OPTIONS_INVALID, X2GOCLIENT_NETWORK_SSH_ERROR_OPENSSH_VERSION_NO_STDERR, X2GOCLIENT_NETWORK_SSH_ERROR_OPENSSH_VERSION_ALLOCATE, }; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git _______________________________________________ x2go-commits mailing list x2go-commits@lists.x2go.org https://lists.x2go.org/listinfo/x2go-commits