summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Clark <nate@neworld.us>2017-09-27 19:51:43 -0400
committerAmadeusz Sławiński <amade@asmblr.net>2017-09-28 10:54:37 +0200
commit9019b0d063dad728c2d9f38c9443c409b6111e4b (patch)
tree9a083a464a6a9b9d4e13cfc17a8bf43e7ef4b434
parent81d89922ad6b09542ce4e6f29cf6e8fbe948e1f7 (diff)
downloadscreen-9019b0d063dad728c2d9f38c9443c409b6111e4b.tar.gz
termcap.c: in FreeTransTable set D_xtable to NULL
After freeing D_xtable set the value to NULL so that checks of D_xtable return false. RAW_PUTCHAR can cause a segfault if invoked after FreeTransTable. This can happen in FreeDisplay when SetTTY encounters an error performing an ioctl on the tty. 0 0x000055583e7032a4 in RAW_PUTCHAR (c=110) at display.c:656 1 0x000055583e6cbe4c in PutWinMsg (s=0x55583e932801 <winmsg_buf+1> "clark-dt -* ", s@entry=0x55583e932800 <winmsg_buf> "nclark-dt -* ", start=<optimized out>, start@entry=0, max=40, max@entry=49) at screen.c:3053 2 0x000055583e7003f6 in PrePutWinMsg (s=0x55583e932800 <winmsg_buf> "nclark-dt -* ", start=0, max=49) at display.c:2174 3 0x000055583e705339 in RefreshLine (y=65, from=<optimized out>, to=48, isblank=0) at display.c:2399 4 0x000055583e70630c in MakeStatus (msg=0x7ffeaa03d7d0 "SetTTY (fd 3): ioctl failed: Input/output error") at display.c:2056 5 0x000055583e6c8a68 in Msg (err=<optimized out>, fmt=<optimized out>) at screen.c:2091 6 0x000055583e6c83a1 in CoreDump (sigsig=<optimized out>) at screen.c:1664 7 <signal handler called> 8 0x000055583e7032a4 in RAW_PUTCHAR (c=110) at display.c:656 9 0x000055583e6cbe4c in PutWinMsg (s=0x55583e932801 <winmsg_buf+1> "clark-dt -* ", s@entry=0x55583e932800 <winmsg_buf> "nclark-dt -* ", start=<optimized out>, start@entry=0, max=40) at screen.c:3053 10 0x000055583e700443 in PrePutWinMsg (s=0x55583e932800 <winmsg_buf> "nclark-dt -* ", start=0, max=<optimized out>) at display.c:2165 11 0x000055583e705339 in RefreshLine (y=65, from=<optimized out>, to=48, isblank=0) at display.c:2399 12 0x000055583e70630c in MakeStatus (msg=0x7ffeaa040780 "SetTTY (fd 3): ioctl failed: Input/output error") at display.c:2056 13 0x000055583e6c8a68 in Msg (err=<optimized out>, fmt=<optimized out>, fmt@entry=0x55583e719f41 "SetTTY (fd %d): ioctl failed") at screen.c:2091 14 0x000055583e6dfadc in SetTTY (fd=<optimized out>, mp=<optimized out>) at tty.c:624 15 0x000055583e707d08 in FreeDisplay () at display.c:340 16 0x000055583e6c8612 in Detach (mode=mode@entry=2) at screen.c:2000 17 0x000055583e6dbb52 in FinishDetach (m=0x55583e933b80 <m>) at socket.c:1607 18 0x000055583e6ddcd5 in FinishAttach (m=m@entry=0x55583e933b80 <m>) at socket.c:1424 19 0x000055583e6de531 in ReceiveMsg () at socket.c:1235 20 0x000055583e711583 in sched () at sched.c:237 21 0x000055583e6c7113 in main (ac=0, av=<optimized out>) at screen.c:1466 Bug: 52133 Signed-off-by: Nate Clark <nate@neworld.us>
-rw-r--r--src/termcap.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/termcap.c b/src/termcap.c
index 6c53e35..1190960 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -1296,6 +1296,7 @@ FreeTransTable()
free(*p);
}
free(D_xtable);
+ D_xtable = NULL;
}
#endif /* FONT */