From dd78d230eae38f8063683f2c9335abdb6af664d3 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Tue, 27 Feb 2018 09:35:29 -0500 Subject: [PATCH] GUACAMOLE-269: Backspace key should send null-terminated string. --- src/terminal/terminal.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index 0dae5ccd..35810dcc 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -1599,7 +1599,12 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed /* Non-printable keys */ else { - if (keysym == 0xFF08) return guac_terminal_send_string(term, &term->backspace); /* Backspace */ + if (keysym == 0xFF08) { + char* backspace_str = malloc(sizeof(char) * 2); + backspace_str[0] = term->backspace; + backspace_str[1] = '\0'; + return guac_terminal_send_string(term, backspace_str); /* Backspace */ + } if (keysym == 0xFF09 || keysym == 0xFF89) return guac_terminal_send_string(term, "\x09"); /* Tab */ if (keysym == 0xFF0D || keysym == 0xFF8D) return guac_terminal_send_string(term, "\x0D"); /* Enter */ if (keysym == 0xFF1B) return guac_terminal_send_string(term, "\x1B"); /* Esc */