From 5842a74a195c1bfa619f977dc7286a0715863645 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Sat, 3 Oct 2015 19:31:57 +0200 Subject: [PATCH] Some code improvements --- src/fterm.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fterm.cpp b/src/fterm.cpp index c21da047..578e16ff 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -1002,10 +1002,10 @@ void FTerm::init() background_color_erase = false; x11_button_state = 0x03; - - // Use format-string to import the untrusted environment variable - snprintf(termtype, sizeof(termtype), "%s", getenv("TERM")); - if ( strnlen(termtype, sizeof(termtype)-1) == 0 ) + char const* term_env = getenv("TERM"); + if ( term_env ) // Import untrusted environment variable TERM + snprintf(termtype, sizeof(termtype), "%s", getenv("TERM")); + else strncpy (termtype, const_cast("vt100"), 6); locale_xterm = getenv("XTERM_LOCALE");