summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Moench-Tegeder <cmt@FreeBSD.org>2019-11-05 15:32:10 +0000
committerAmadeusz Sławiński <amade@asmblr.net>2019-12-28 13:43:22 +0100
commitfa4f88614d3e5994cfb1372353e7316be7235060 (patch)
tree7365720e8fdc5d68e66c501355ada2bc9f2ca120
parentbde659b6bf53348f0550d79e170d3dd396e34d09 (diff)
downloadscreen-fa4f88614d3e5994cfb1372353e7316be7235060.tar.gz
Fix coredump on xterm and rxvt
Here's the rub: with TERM=xterm (or rxvt, for that matter), Km ("key_mouse", "Mouse event has occured") is not set (and therefore NULL), but InitTermcap() (termcap.c:230) happily tries to strdup() that, which gets us that segfault. As a band-aid, catch that NULL and don't strdup(). Signed-off-by: Marcin Cieślak <saper@saper.info>
-rw-r--r--src/termcap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/termcap.c b/src/termcap.c
index fab1894..d7001a4 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -178,7 +178,7 @@ int InitTermcap(int width, int height)
if (strstr(D_termname, "xterm") || strstr(D_termname, "rxvt") || (D_CKM &&
(strstr(D_CKM, "\033[M") || strstr(D_CKM, "\033[<")))) {
D_CXT = 1;
- kmapdef[0] = SaveStr(D_CKM);
+ kmapdef[0] = D_CKM ? SaveStr(D_CKM) : NULL;
}
/* "be" seems to be standard for xterms... */
if (D_CXT)