1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Stop accidentally sending wchar_t as terminal input!

When term_input_data_from_charset receives data in a specified
character set (that isn't a negative number indicating "just send
binary"), it was translating from that character set into wide-
character Unicode, but then forgetting to translate back again into
the terminal's configured character set.

Introduced by the rewrite in commit 4f756d2a4d. Affected the
answerback string sent in response to ^E, and I think potentially some
paths through term_keyinput too, although I haven't quite worked out
which ones would have been affected.
This commit is contained in:
Simon Tatham 2024-11-21 13:10:22 +00:00
parent 41473d915b
commit 4e50c86040

View File

@ -3506,14 +3506,19 @@ static strbuf *term_input_data_from_unicode(
static strbuf *term_input_data_from_charset(
Terminal *term, int codepage, const char *str, size_t len)
{
strbuf *buf = strbuf_new();
if (codepage < 0)
if (codepage < 0) {
strbuf *buf = strbuf_new();
put_data(buf, str, len);
else
put_mb_to_wc(buf, codepage, str, len);
return buf;
} else {
strbuf *wide = strbuf_new();
put_mb_to_wc(wide, codepage, str, len);
strbuf *buf = term_input_data_from_unicode(
term, (const wchar_t *)wide->s, wide->len / sizeof(wchar_t));
strbuf_free(wide);
return buf;
}
return buf;
}
static inline void term_bracketed_paste_start(Terminal *term)