From: Christoph Moench-Tegeder <c...@freebsd.org>

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 <sa...@saper.info>
---
 src/termcap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/termcap.c b/src/termcap.c
index 1d4724d..445d5fc 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)
-- 
2.23.0


Reply via email to