From 305ce5b598bdaa87744ae86bc2085dd13bfea002 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Fri, 22 Dec 2017 03:20:32 -0800 Subject: [PATCH] TMXR: Fix potential SegFault while negotiating telnet options If a telnet session sends options just prior to closing a session, the response traffic might get dropped which isn't a problem, but we need to make sure that we stop referencing the now invalid line structure after that happens. --- sim_tmxr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sim_tmxr.c b/sim_tmxr.c index 4485bc07..5c660ba5 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -1979,7 +1979,8 @@ for (i = 0; i < mp->lines; i++) { /* loop thru lines */ lp->notelnet = FALSE; tmxr_putc_ln (lp, TN_WONT); tmxr_putc_ln (lp, tmp); - lp->telnet_sent_opts[tmp] |= TNOS_WONT;/* Record WONT sent */ + if (lp->conn) /* Still connected ? */ + lp->telnet_sent_opts[tmp] |= TNOS_WONT;/* Record WONT sent */ } } case TNS_SKIP: default: /* skip char */