From rswindell@1:103/705 to CVS commit on Thu Oct 25 02:08:29 2018
src/syncterm conn_telnet.c 1.11 1.12 term.c 1.341 1.342
Update of /cvsroot/sbbs/src/syncterm
In directory cvs:/tmp/cvs-serv2340
Modified Files:
conn_telnet.c term.c
Log Message:
Work-around race condition causing NULL-pointer dereference: telnet_input_thread() is started before cterm_init() is called, so the
global "cterm" pointer was (sometimes) NULL at the time that the input
thread received a "do termina-type" request, and telnet_interpret would dereference cterm (to get the emulation type) and thus crash. This is
an inelegant solution which halts the telnet_input_thread() until the
cterm pointer has been initialized. Also, be sure to reset cterm to
NULL after calling cterm_end() which free's it. This fixes the problem of
the telnet_input_thread() potentially using a stale (free'd) copy of cterm
for the terminal-type response on subsequent connects.