[83] in Zephyr_Bugs

home help back first fref pref prev next nref lref last post

7.1H DS3100 zwgc segfaults

daemon@ATHENA.MIT.EDU (epeisach@ATHENA.MIT.EDU)
Tue Aug 14 17:41:54 1990

From: epeisach@ATHENA.MIT.EDU
Date: Tue, 14 Aug 90 17:41:38 EDT
To: bugs@ATHENA.MIT.EDU
Cc: bug-zephyr@ATHENA.MIT.EDU


If you have absolutly no resources loaded into an X server and try
starting zwgc, it segfaults in XrmGetStringDatabase. TYhe man page
indicates that it expects a "null terminated string." As far as I can
tell, a NULL pointer is not a null terminated string and causes the
segfault. Ideally the X library should return NULL in this case, but it
doesn't. I will send a separate bug report to the Consortium suggesting
that they test for it and return null in that case. Looking at other
routines in the X library appears to make the check and fall back on a
users "~/.Xdefaults" file. 

Reproduce by:

a) remotely log into a DS3100
b) Start the X server and pop up an xclock on it
c) /usr/etc/zwgc -display :0
See the nice segfault.

	Ezra

Fix as follows: (will be installed shortly in the build used on the DS3100)

RCS file: RCS/X_driver.c,v
retrieving revision 1.1
diff -c -r1.1 X_driver.c
*** /tmp/,RCSt1a28975	Tue Aug 14 17:35:04 1990
--- X_driver.c	Tue Aug 14 17:27:30 1990
***************
*** 274,280 ****
      /*
       * Get resources from the just opened display:
       */
!     temp_db2 = XrmGetStringDatabase(dpy->xdefaults);
  
      /*
       * Merge the 4 sets of resources together such that when searching
--- 274,283 ----
      /*
       * Get resources from the just opened display:
       */
!     if(dpy->xdefaults != NULL)
! 	temp_db2 = XrmGetStringDatabase(dpy->xdefaults);
!     else
! 	temp_db2 = NULL;
  
      /*
       * Merge the 4 sets of resources together such that when searching

home help back first fref pref prev next nref lref last post