This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository libx2goclient. commit 5d6eef026538461eb9fcdebed5ff159fe9976c2b Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jul 29 11:25:00 2020 +0200 src/x2goclient-network-ssh.c: fix UB when printing OpenSSH client command array elements being NULL (and hence not strings) and clean up the code a bit. --- src/x2goclient-network-ssh.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c index 472f7db..540ac1e 100644 --- a/src/x2goclient-network-ssh.c +++ b/src/x2goclient-network-ssh.c @@ -955,20 +955,21 @@ static gboolean x2goclient_network_ssh_parent_connect (X2GoClientNetwork *parent * Yeah, this is potentially slow, but there is no better way to use * g_log (). */ - const gchar *tmp_start = "Would try to connect via:"; - gchar *tmp = NULL; + gchar *tmp = g_strdup ("Would try to connect via:"); for (gsize i = 0; i < ssh_cmd->len; ++i) { gchar *tmp_new = NULL; + gchar *cur_entry = (gchar *)g_ptr_array_index (ssh_cmd, i); + const gchar *empty = "(NULL)"; - if (0 == i) { - tmp_new = g_strdup_printf ("%s [%s]", tmp_start, (gchar *)g_ptr_array_index (ssh_cmd, i)); + if (cur_entry) { + tmp_new = g_strdup_printf ("%s [%s]", tmp, cur_entry); } else { - tmp_new = g_strdup_printf ("%s [%s]", tmp, (gchar *)g_ptr_array_index (ssh_cmd, i)); - - g_free (tmp); + tmp_new = g_strdup_printf ("%s [%s]", tmp, empty); } + g_free (tmp); + tmp = tmp_new; } g_log (NULL, G_LOG_LEVEL_DEBUG, "%s", tmp); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git