ttsession: don't segfault if host name isn't properly set
authoralx <alx@fastestcode.org>
Fri, 30 Dec 2016 00:35:38 +0000 (01:35 +0100)
committerJon Trulson <jon@radscan.com>
Sat, 31 Dec 2016 22:14:59 +0000 (15:14 -0700)
cde/lib/tt/lib/mp/mp_desktop.C

index cf5a075a245f49a6664544380588fa215e1f6c1a..36df33d2a6e2b8d0ae12cedc944c0d750c7d478a 100644 (file)
@@ -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;