1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-08 08:58:00 +00:00

Remove assertion that len != 0 in ldisc_send.

A user reported another situation in which that assertion can fail: if
you paste text into the terminal that consists 100% of characters not
available in the CONF_line_codepage character set, then the
translation step generates the empty string as output, and that gets
passed to ldisc_send by term_paste without checking.

Previous bugs of this kind (see commits 4634cd47f7 and 43a63019f5)
were fixed by adding a check before calling ldisc_send. But in commit
4634cd47f7 I said that probably at some point the right fix would be
to remove the assertion in ldisc_send itself, so that passing len==0
becomes legal. (The assertion was there in the first place to catch
cases where len==0 was used with its obsolete special meaning of
signalling 'please update your status'.)

Well, I think it's finally time. The assertion is removed: it's now
legal again to call ldisc_send with an empty buffer, and its meaning
is no longer the archaic special thing, but the trivial one of sending
zero characters through the line discipline.

(cherry picked from commit cd3e917fd0)
This commit is contained in:
Simon Tatham 2020-06-14 10:06:17 +01:00
parent d527b1a886
commit 6aa1dcb1ca

View File

@ -130,7 +130,6 @@ void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, bool interactive)
int keyflag = 0;
assert(ldisc->term);
assert(len);
if (interactive) {
/*