summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Moench-Tegeder <cmt@FreeBSD.org>2019-11-05 15:32:54 +0000
committerAmadeusz Sławiński <amade@asmblr.net>2019-12-28 13:43:34 +0100
commitc4a059f1170eaf1ffb4ce18804944d744a73f6e8 (patch)
tree8db1d6f07dc20970da568c82e5b199db61630e5d
parent09bbd3eff39817a1ee8bb0d56393b156aa86eb05 (diff)
downloadscreen-c4a059f1170eaf1ffb4ce18804944d744a73f6e8.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 bedf1aa..d0ce5d2 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -227,7 +227,7 @@ int he;
(D_CKM && (InStr(D_CKM, "\033[M") || InStr(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)