Github user mike-jumper commented on a diff in the pull request:
https://github.com/apache/guacamole-server/pull/156#discussion_r178483453
--- Diff: src/protocols/ssh/ssh.c ---
@@ -191,6 +192,10 @@ void* ssh_client_thread(void* data) {
return NULL;
}
+ /* Initialize a ttymode array */
+ const int num_tty_opcodes = 1;
+ char ssh_ttymodes[(GUAC_SSH_TTY_OPCODE_SIZE * num_tty_opcodes) + 1];
--- End diff --
Not really a dealbreaker, but if you want to ensure this is a constant
expression while also abstracting away the calculations required, this could be
handled via a macro defined in `ttymode.h`. For example:
#define GUAC_SSH_TTYMODES_SIZE(num_opcodes) ((GUAC_SSH_TTY_OPCODE_SIZE
* num_opcodes) + 1)
You could then rely upon:
char ssh_ttymodes[GUAC_SSH_TTYMODES_SIZE(1)];
... and, of course, documenting within `guac_ssh_ttymodes_init()` how the
minimum size for the provided buffer should be calculated.
Magic.
---