mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Avoid zero-length ldisc_send() in terminal.c.
A user reports that a remote window title query, if the window title
is empty or if the option to return it is disabled, fails the
assertion in ldisc_send that I introduced as part of commit c269dd013
to catch any lingering uses of ldisc_send with length 0 that should
have turned into ldisc_echoedit_update. Added a check for len > 0
guarding that ldisc_send call, and likewise at one or two others I
noticed on my way here.
(Probably at some point I should decide that the period of smoking out
lingering old-style ldisc_send(0) calls is over, and declare it safe
to remove that assertion again and get rid of all the cumbersome
safety checks at call sites like these ones. But not quite yet.)
This commit is contained in:
parent
a459fc58e8
commit
4634cd47f7
10
terminal.c
10
terminal.c
@ -3355,7 +3355,7 @@ static void term_out(Terminal *term)
|
|||||||
break;
|
break;
|
||||||
case 'Z': /* DECID: terminal type query */
|
case 'Z': /* DECID: terminal type query */
|
||||||
compatibility(VT100);
|
compatibility(VT100);
|
||||||
if (term->ldisc)
|
if (term->ldisc && term->id_string[0])
|
||||||
ldisc_send(term->ldisc, term->id_string,
|
ldisc_send(term->ldisc, term->id_string,
|
||||||
strlen(term->id_string), 0);
|
strlen(term->id_string), 0);
|
||||||
break;
|
break;
|
||||||
@ -3662,7 +3662,7 @@ static void term_out(Terminal *term)
|
|||||||
case 'c': /* DA: terminal type query */
|
case 'c': /* DA: terminal type query */
|
||||||
compatibility(VT100);
|
compatibility(VT100);
|
||||||
/* This is the response for a VT102 */
|
/* This is the response for a VT102 */
|
||||||
if (term->ldisc)
|
if (term->ldisc && term->id_string[0])
|
||||||
ldisc_send(term->ldisc, term->id_string,
|
ldisc_send(term->ldisc, term->id_string,
|
||||||
strlen(term->id_string), 0);
|
strlen(term->id_string), 0);
|
||||||
break;
|
break;
|
||||||
@ -4069,7 +4069,8 @@ static void term_out(Terminal *term)
|
|||||||
p = EMPTY_WINDOW_TITLE;
|
p = EMPTY_WINDOW_TITLE;
|
||||||
len = strlen(p);
|
len = strlen(p);
|
||||||
ldisc_send(term->ldisc, "\033]L", 3, 0);
|
ldisc_send(term->ldisc, "\033]L", 3, 0);
|
||||||
ldisc_send(term->ldisc, p, len, 0);
|
if (len > 0)
|
||||||
|
ldisc_send(term->ldisc, p, len, 0);
|
||||||
ldisc_send(term->ldisc, "\033\\", 2, 0);
|
ldisc_send(term->ldisc, "\033\\", 2, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4082,7 +4083,8 @@ static void term_out(Terminal *term)
|
|||||||
p = EMPTY_WINDOW_TITLE;
|
p = EMPTY_WINDOW_TITLE;
|
||||||
len = strlen(p);
|
len = strlen(p);
|
||||||
ldisc_send(term->ldisc, "\033]l", 3, 0);
|
ldisc_send(term->ldisc, "\033]l", 3, 0);
|
||||||
ldisc_send(term->ldisc, p, len, 0);
|
if (len > 0)
|
||||||
|
ldisc_send(term->ldisc, p, len, 0);
|
||||||
ldisc_send(term->ldisc, "\033\\", 2, 0);
|
ldisc_send(term->ldisc, "\033\\", 2, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user