Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!gatech!bbn!diamond.bbn.com!mlandau
From: mlandau@bbn.com (Matt Landau)
Newsgroups: comp.windows.x
Subject: Re: Fixes to paint and xedit in V11.2
Message-ID: <7439@diamond.BBN.COM>
Date: Sat, 25-Jul-87 14:14:19 EDT
Article-I.D.: diamond.7439
Posted: Sat Jul 25 14:14:19 1987
Date-Received: Sun, 26-Jul-87 01:57:29 EDT
References: <4477@jade.BERKELEY.EDU>
Reply-To: mlandau@bbn.com (Matt Landau)
Organization: BBN Laboratories Incorporated, Cambridge, MA
Lines: 30
Summary: it's worse than you think

In comp.windows.x jkh@violet.berkeley.edu (Jordan K. Hubbard) writes:
>Ed Moy and I found a few irritating bugs..
>
>1. in line 232 of clients/xedit/xedit.c, rindex is blindly called
>	with argv[1] to see if it's a display argument. On the
>	vax, null pointers can be deref'd, so no problem.. On the
>	Sun, however.. This is fixed by checking to see if the arg
>	is null first..

It's worse than that.  The entire Xt Toolkit blithely assumes that 
you can pass arbitrary pointers to strcmp, strcpy, index, etc.  Any
program that uses the toolkit and tries to do, for instance, buttons,
will crash on a 68k.  (Yes, I *KNOW* the toolkit is considered in
alpha release, but seriously, this strikes me as the kind of thing 
that shouldn't creep into the code in first place.)

I fixed the toolkit by replacing all the calls to the various string
functions with versions called XtStrCmp, XtStrCpy, etc. that handle
NULL pointer arguments as would a VAX.  I'll be sending out a bug
report on the X11 toolkit that contains diffs for this.

HOWEVER, as Jordan and Ed discovered, just fixing the toolkit doesn't
do it, since some of the clients are also broken in how they deal 
with pointers.  Rather than try to find and fix all the bogosity in
the clients, I punted and installed my own (VAX-style) versions of
all the string routines in libX11.a -- if you can't make 'em fix it,
at least you can make it work.
-- 
 Matt Landau			Oblivion gallops closer,
 mlandau@bbn.com		    favoring the spur, sparing the rein...