Bug#217509: segfaults if TERM is not set

* terms.c (check_cygwin_console): check TERM==NULL
	(set_tty): check TERM==NULL
From: Fumitoshi UKAI  <ukai@debian.or.jp>
This commit is contained in:
Fumitoshi UKAI
2003-12-08 16:06:33 +00:00
parent 44fdbe22fc
commit a850e05763
2 changed files with 19 additions and 9 deletions

View File

@@ -1,3 +1,9 @@
2003-10-26 Fumitoshi UKAI <ukai@debian.or.jp>
* Bug#217509: segfaults if TERM is not set
* terms.c (check_cygwin_console): check TERM==NULL
(set_tty): check TERM==NULL
2003-10-23 ABE Yuji <cbo46560@pop12.odn.ne.jp> 2003-10-23 ABE Yuji <cbo46560@pop12.odn.ne.jp>
* [w3m-dev 04011] accessing to an `https' URI with a fragment via a proxy * [w3m-dev 04011] accessing to an `https' URI with a fragment via a proxy
@@ -8255,4 +8261,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1 * release-0-2-1
* import w3m-0.2.1 * import w3m-0.2.1
$Id: ChangeLog,v 1.890 2003/10/22 18:48:09 ukai Exp $ $Id: ChangeLog,v 1.891 2003/12/08 16:06:33 ukai Exp $

20
terms.c
View File

@@ -1,4 +1,4 @@
/* $Id: terms.c,v 1.50 2003/10/05 18:52:51 ukai Exp $ */ /* $Id: terms.c,v 1.51 2003/12/08 16:06:34 ukai Exp $ */
/* /*
* An original curses library for EUC-kanji by Akinori ITO, December 1989 * An original curses library for EUC-kanji by Akinori ITO, December 1989
* revised by Akinori ITO, January 1995 * revised by Akinori ITO, January 1995
@@ -220,7 +220,9 @@ check_cygwin_console(void)
char *term = getenv("TERM"); char *term = getenv("TERM");
HANDLE hWnd; HANDLE hWnd;
if (strncmp(term, "cygwin", 6) == 0) { if (term == NULL)
term = DEFAULT_TERM;
if (term && strncmp(term, "cygwin", 6) == 0) {
isWinConsole = 1; isWinConsole = 1;
} }
if (isWinConsole) { if (isWinConsole) {
@@ -485,12 +487,14 @@ set_tty(void)
#ifdef USE_MOUSE #ifdef USE_MOUSE
{ {
char *term = getenv("TERM"); char *term = getenv("TERM");
struct w3m_term_info *p; if (term != NULL) {
for (p = w3m_term_info_list; p->term != NULL; p++) { struct w3m_term_info *p;
if (!strncmp(term, p->term, strlen(p->term))) { for (p = w3m_term_info_list; p->term != NULL; p++) {
is_xterm = p->mouse_flag; if (!strncmp(term, p->term, strlen(p->term))) {
break; is_xterm = p->mouse_flag;
} break;
}
}
} }
} }
#endif #endif