GUACAMOLE-269: Backspace key should send null-terminated string.

This commit is contained in:
Nick Couchman 2018-02-27 09:35:29 -05:00
parent c286668b79
commit dd78d230ea

View File

@ -1599,7 +1599,12 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed
/* Non-printable keys */ /* Non-printable keys */
else { 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 == 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 == 0xFF0D || keysym == 0xFF8D) return guac_terminal_send_string(term, "\x0D"); /* Enter */
if (keysym == 0xFF1B) return guac_terminal_send_string(term, "\x1B"); /* Esc */ if (keysym == 0xFF1B) return guac_terminal_send_string(term, "\x1B"); /* Esc */