diff --git a/src/protocols/ssh/ssh.c b/src/protocols/ssh/ssh.c index 6aecde0c..eac4eced 100644 --- a/src/protocols/ssh/ssh.c +++ b/src/protocols/ssh/ssh.c @@ -193,7 +193,7 @@ void* ssh_client_thread(void* data) { } /* Initialize a ttymode array */ - guac_ssh_ttymodes ssh_ttymodes = guac_ssh_ttymodes_init(); + guac_ssh_ttymodes* ssh_ttymodes = guac_ssh_ttymodes_init(); /* Set up screen recording, if requested */ if (settings->recording_path != NULL) { @@ -213,7 +213,7 @@ void* ssh_client_thread(void* data) { settings->color_scheme, settings->backspace); /* Add the backspace key to the ttymode array */ - guac_ssh_ttymodes_add(&ssh_ttymodes, GUAC_SSH_TTY_OP_VERASE, settings->backspace); + guac_ssh_ttymodes_add(ssh_ttymodes, GUAC_SSH_TTY_OP_VERASE, settings->backspace); /* Fail if terminal init failed */ if (ssh_client->term == NULL) { @@ -305,7 +305,7 @@ void* ssh_client_thread(void* data) { /* Request PTY */ if (libssh2_channel_request_pty_ex(ssh_client->term_channel, "linux", sizeof("linux")-1, - guac_ssh_ttymodes_to_array(&ssh_ttymodes), guac_ssh_ttymodes_size(&ssh_ttymodes), + guac_ssh_ttymodes_to_array(ssh_ttymodes), guac_ssh_ttymodes_size(ssh_ttymodes), ssh_client->term->term_width, ssh_client->term->term_height, 0, 0)) { guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR, "Unable to allocate PTY."); return NULL; diff --git a/src/protocols/ssh/ttymode.c b/src/protocols/ssh/ttymode.c index f21e9f7f..02fb54ba 100644 --- a/src/protocols/ssh/ttymode.c +++ b/src/protocols/ssh/ttymode.c @@ -23,15 +23,14 @@ #include #include -guac_ssh_ttymodes guac_ssh_ttymodes_init() { +guac_ssh_ttymodes* guac_ssh_ttymodes_init() { /* Simple allocation for a placeholder */ guac_ssh_ttymode* ttymode_array = malloc(1); /* Set up the initial data structure. */ - guac_ssh_ttymodes empty_modes = { - ttymode_array, - 0 - }; + guac_ssh_ttymodes* empty_modes = malloc(sizeof(guac_ssh_ttymodes)); + empty_modes->ttymode_array = ttymode_array; + empty_modes->num_opcodes = 0; return empty_modes; } diff --git a/src/protocols/ssh/ttymode.h b/src/protocols/ssh/ttymode.h index ca5569d4..ecc57de0 100644 --- a/src/protocols/ssh/ttymode.h +++ b/src/protocols/ssh/ttymode.h @@ -62,7 +62,7 @@ typedef struct guac_ssh_ttymodes { * with a null array of guac_ssh_ttymode and opcodes * set to zero. */ -guac_ssh_ttymodes guac_ssh_ttymodes_init(); +guac_ssh_ttymodes* guac_ssh_ttymodes_init(); /** * Add an item to the opcode array. This resizes the