From cd3e917fd0c52865c8978a4e277050580299fbac Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 14 Jun 2020 10:06:17 +0100 Subject: [PATCH] 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. --- ldisc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ldisc.c b/ldisc.c index 8eb80175..f097c040 100644 --- a/ldisc.c +++ b/ldisc.c @@ -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) { /*