rcs blows up on suns

Guy Harris guy at sun.uucp
Sat Sep 14 12:03:44 AEST 1985


> In article <2772 at sun.uucp> guy at sun.uucp (Guy Harris) writes:
> > (Whole damn article cited!)

A summary would have been sufficient.

>    I think that there are a goodly number of null pointer/strcmp bugs
> in rcs; we had a minimally version that no one pushed too hard until
> recently, when some of these bugs began to pop up.  Delving into the
> source, I found a *lot* of places that looked like they potentially
> had this bug; I'm pretty sure that I had to fix one (not the one above)
> just to get it to run at all back when I first brought it up here.

We brought up the RCS that came off the 4.2BSD tape at CCI on our Power
5/20s; not only did they prohibit null pointer dereferencing, but they also
had 16-bit "int"s and 32-bit pointers, so all the null pointers passed as
arguments had to be properly cast and functions had to be properly declared.
We never saw any null-pointer-dereference problems other than the one
listed.  We may not have exercised all the paths through RCS, so there may
be others lurking.

> Since I was feeling lazy and in a hurry, I just wrote another strcmp
> that does relatively intelligent things with null pointers...

The only intelligent thing to do with a null pointer is to avoid
dereferencing it, and the most intelligent way to do that is to say "if this
pointer is null, it probably means that some argument wasn't supplied or
something like that.  As such, I probably want to do very different
processing - something like using the default value for that argument, or
not do whatever processing uses that argument's value, or something like
that.  If I do so, I'll probably automatically avoid dereferencing that null
pointer."

	Guy Harris



More information about the Comp.unix mailing list