diff --git a/src/fterm.cpp b/src/fterm.cpp index 13c6ce2f..0a057aaf 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -1004,10 +1004,10 @@ void FTerm::init() background_color_erase = false; x11_button_state = 0x03; - // Import untrusted environment variable TERM + // Import the untrusted environment variable TERM const char* term_env = getenv(const_cast("TERM")); if ( term_env ) - strncpy (termtype, term_env, strlen(term_env)); + strncpy (termtype, term_env, sizeof(termtype) - 1); else strncpy (termtype, const_cast("vt100"), 6);