From 843401a9359dec4d5d7bbb4ee7cf0582efeb3703 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 10 Mar 2012 15:58:19 -0500 Subject: [PATCH] Display::Display: Fix undefined pointer comparison MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “If two pointers p and q of the same type point to different that are not members of the same object or elements of the same array or to different functions, or if only one of them is null, the results of pq, p<=q, and p>=q are unspecified.” Signed-off-by: Anders Kaseorg --- src/terminal/terminaldisplayinit.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/terminal/terminaldisplayinit.cc b/src/terminal/terminaldisplayinit.cc index 6519b26..22a2cd5 100644 --- a/src/terminal/terminaldisplayinit.cc +++ b/src/terminal/terminaldisplayinit.cc @@ -54,7 +54,9 @@ Display::Display( bool use_environment ) char ech_name[] = "ech"; char *val = tigetstr( ech_name ); - if ( val <= 0 ) { + if ( val == (char *)-1 ) + throw std::string( "Invalid terminfo string capability " ) + ech_name; + if ( val == 0 ) { has_ech = false; } }