From ae7dd95cc46db7ae3578b4b498230fd805b4e28a Mon Sep 17 00:00:00 2001 From: alx Date: Fri, 30 Dec 2016 01:35:38 +0100 Subject: [PATCH] ttsession: don't segfault if host name isn't properly set --- cde/lib/tt/lib/mp/mp_desktop.C | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cde/lib/tt/lib/mp/mp_desktop.C b/cde/lib/tt/lib/mp/mp_desktop.C index cf5a075a..36df33d2 100644 --- a/cde/lib/tt/lib/mp/mp_desktop.C +++ b/cde/lib/tt/lib/mp/mp_desktop.C @@ -416,7 +416,10 @@ parse_Xdisplay_string(_Tt_string display, _Tt_string &host, pid_t &svnum,_Tt_str if (offset == 0) { // use local host - (void)_tt_global->get_local_host(h); + if(!_tt_global->get_local_host(h)){ + _tt_syslog(0,LOG_ERR,"get_local_host(): 0"); + return 0; + } host = h->stringaddr(); hostname = h->name(); status = 2; @@ -427,7 +430,10 @@ parse_Xdisplay_string(_Tt_string display, _Tt_string &host, pid_t &svnum,_Tt_str host = display.mid(0, offset); if (host == "unix") { - (void)_tt_global->get_local_host(h); + if(!_tt_global->get_local_host(h)){ + _tt_syslog(0,LOG_ERR,"get_local_host(): 0"); + return 0; + } host = h->stringaddr(); hostname = h->name(); status = 3; -- 2.25.1