Skip to content

Commit

Permalink
TMXR: Avoid potential NULL pointer dereference after aborted ATTACH
Browse files Browse the repository at this point in the history
  • Loading branch information
markpizz committed Apr 10, 2023
1 parent ede493a commit f98a925
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sim_tmxr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2407,7 +2407,8 @@ for (i = 0; i < mp->lines; i++) { /* loop thru lines */
static int32 tmxr_rqln_bare (const TMLN *lp, t_bool speed)
{
if (speed) {
if (lp->send->extoff < lp->send->insoff) {/* buffered SEND data? */
if ((lp->send != NULL) &&
(lp->send->extoff < lp->send->insoff)) {/* buffered SEND data? */
if (sim_gtime () < lp->send->next_time) /* too soon? */
return 0;
else
Expand Down Expand Up @@ -4173,7 +4174,8 @@ for (i=0; i<mp->lines; i++) {
TMLN *lp = &mp->ldsc[i];

if (uptr == lp->uptr) { /* read polling unit? */
if ((lp->send->extoff < lp->send->insoff) &&
if ((lp->send != NULL) &&
(lp->send->extoff < lp->send->insoff) &&
(sim_gtime_now < lp->send->next_time))
due = (int32)(lp->send->next_time - sim_gtime_now);
else {
Expand Down Expand Up @@ -4725,9 +4727,9 @@ if ((lp->serport == 0) && (lp->sock) && (!lp->datagram))
fprintf (st, " %s\n", (lp->notelnet) ? "Telnet disabled (RAW data)" : "Telnet protocol");
if ((!lp->notelnet) && (lp->nomessage))
fprintf (st, " Telnet connect message disabled\n");
if (lp->send->buffer)
if ((lp->send != NULL) && (lp->send->buffer))
sim_show_send_input (st, lp->send);
if (lp->expect->buf)
if ((lp->expect != NULL) && (lp->expect->buf))
sim_exp_showall (st, lp->expect);
if (lp->txlog)
fprintf (st, " Logging to %s\n", lp->txlogname);
Expand Down

0 comments on commit f98a925

Please sign in to comment.